Web Analytics

Fill the form & Get Installation Support

Any Question or Concerns?
Let's discuss





    More/Less functionality in Magento2

    Related articles

    First of all, we need to create several files:

    Let’s review these files and see here description for each one regarding which code will be placed inside of them:

    requirejs-config.js

    Use this file to register your own JavaScript component:

    catalog_product_view.xml

    Inside of the content  container, a new block is created with a specified template file that is going to be used:

    more-less.phtml

    This file contains the basic configuration of the more/less functionality.

    toggle-product-description.js

    Place all of your JavaScript logic in this file. Skeleton of such a JavaScript component should be like this:

    _theme.less

    This is an optional file for you to create, I have created some minimal styling (transparent-to-solid background) as a nice effect on the more/less button.

    Here is how it looks like on the frontend:

    Contact us for scientific strategies to increase your site conversions





      Connect With Us