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.
Some users, still require to have the below number field for the product quantity. Here’s a screenshot of the old quantity field –
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).