Web Analytics

Fill the form & Get Installation Support

Add Quantity Increment and decrements Button in Magento 2

Configure Module

Configure your module by creating a module.xml file at app/code/Magemonkeys/QtyIncrement/etc. Add the following code in it:


Registration of Module

Now, register the module by creating registration.php at app/code/Magemonkeys/QtyIncrement, and add the following code in it:


Copy addtocart.phtml

Go to vendor/magento/module-catalog/view/frontend/templates/product/view from the root directory of your store and copy addtocart.phtml to your own module app/code /Magemonkeys/QtyIncrement/view/frontend/templates/catalog/product/view

Edit addtocart.phtml

Create qty_change.js

Now, create qty_change.js at app/code/Magemonkeys/QtyIncrement/view/frontend/web/js/view/product/view. Add the following code in it:

Create catalog_product_view.xml

Lastly, just create catalog_product_view.xml  at app/code/Magemonkeys/QtyIncrement/view/frontend/layout. Add the following code in it:

Run the Commands

Go to the root directory of your store by using SSH terminal and run the following commands:

Now, go to the product page and you will see the result:

Fill the below form if you have any Magento programming need.

    Recent Articles

    Author Info

    Author Image

    Magento Certified Developer

    Hire J. Lakum

    Get a Free Quote

      /* second popup */

      Connect With Us