How to Disable Product Quantity (Plus-Minus) Buttons?
|
/ Documentation /Custom Code Snippets/WooCommerce Filters/ How to Disable Product Quantity (Plus-Minus) Buttons?

How to Disable Product Quantity (Plus-Minus) Buttons?

In Astra Pro Addon’s version 2.1.0, we have improved the Product Quantity input’s old number field and replaced it with the Plus-Minus buttons.

For which we have provided a Filter that will disable the Product Quantity’s Plus-Minus buttons. This will be for the Product Quantity field on the WooCommerce Cart and Single Product Page.

This change could now be seen for the Product Quantity Input field on WooCommerce Cart and Single Product Page.

Product Quantity old buttons before Astra 2.1.0

Some users, still require to have the below number field for the product quantity. Here’s a screenshot of the old quantity field –

Astra New Product Quantity Buttons Old

To achieve this requirement, we are providing a filter in our Astra Pro Addon’s plugin version 2.1.3. Make sure you update the plugin to version 2.1.3 or above to use the filter.

add_filter( 'astra_add_to_cart_quantity_btn_enabled', '__return_false' ); 

Description: This filter is built to replace the product quantity’s new plus-minus field to the old number field.

You will need to add this filter, in the child theme’s last line of functions.php.

Note: Since this functionality is JavaScript based, in some cases this functionality might not work with the third-party plugins, and in such cases, users can also use the above filter.

Using the Code with Astra Pro

If you also have Astra Pro (Addon) Plugin installed and active, you might need additional steps. To make the changes visible on the front end, you will need to clear the Astra Cache. Please follow these steps:

Step 1 – Add a filter code functions.php file of your Astra Child Theme;

Step 2 – Navigate to Appearance > Astra Options and scroll down to the “Available Astra Pro Modules” section

Step 3 – Click the “Deactivate All” button, and then click the “Activate All” button (you can disable modules you don’t need afterward).

Step 4 – Check the front end of your website. If you still don’t see the change, please clear your browser cache by doing the hard refresh using Ctrl + Shift + R (Windows) / ⌘ Cmd + Shift + R (Mac).

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form