Use code MGT25 to get $25 off! Limited time offer on Cloudways Magento hosting

Add Qty Increment Buttons In Magento

Magento provides simple input text field on product page for quantity. But to make it more attractive and easier for customers, you can add an increment quantity button in Magento.

Today, we are going to learn how to add quantity increment buttons to product page. We can do this by editing core files but it’s not the right approach. So, we’ll add quantity increment buttons to product page in Magento by using custom module.

You can learn How to create a Magento 1.9 Custom Module if you don’t already know.

Create Directories

We will use Cloudways as Namespace and Qty as Module name.

Go to your module and create the following directories in it:

1.  etc
2.  Model
3.  Block
4.  Template

Configuration of Module

Go to app/code/local/Cloudways/Qty/etc and create config.xml. Now place the following code in it:

Activation Of Module

Go to app/etc/modules and create Cloudways_Qty.xml. Now place the following code in it:

Create Model

Go to app/code/local/Cloudways/Qty/Model and create Observer.php. Now place the following code in it:

Create Block

Go to app/code/local/Cloudways/Qty/Block and create Injection.php. Now place the following code in it:

Create Template File

Go to app/code/local/Cloudways/Qty/template and create quantity.phtml. Now place the following code in it:


Go to skin/frontend/your-theme/default/css in the root directory of Magento and create custom.css. Add the following code in it:

Now, to execute your custom css file, go to app/design/frontend/your-theme/default/layout/page.xml and place following code before </default>:

Go to your product page now and you will see the result.

add quantity buttons magento

Final Words

After this tutorial, you should be able to add quantity increment buttons to product page. After you’ve done this, it will be easier for your customers to add the quantity of products. I hope that you had no problem in following the simple steps of the process. If you have a problem or would like to add to the discussion, leave a comment below!

About Author

Syed Muneeb Ul Hasan is an expert in PHP and Magento, he prefers to educate users in implementing and learning Magento. When not working, he loves to watch cricket.

  • shiva ppc

    Please help me to resolve this error “Mage registry key “_singleton/Cloudways_Qty_Model_Observer” already exists”. Thanks

    • This may be caused due to cache, are you sure it’s cleared? If not, please clean your cache. After that disable your Magento compiler and enable it and re run the compilation again.

  • Arup Ganguli

    i want that quantity selector in wherever add to cart button appears. how to do that?

  • Gizzet

    Hi Muneeb,
    Thank you for these instructions. They worked great for me with only some stylistic adjustments. Allow me a question please: why are the increment buttons not being enabled also in the shopping basket?

    • Thanks for your appreciation. Well in this guide I have shown the method only to add increment and decrement quantity button in Magento 2 product page.

      • Gizzet

        Thank you for your reply! Actually I can confirm that the Module also works on Magento 1.9! It also works by the way on the grouped product page, it only needs different CSS-styles.

      • M.hamza mustafa

        bro i need your help