Tagged: 3rd-Party Plugin, Crio
- AuthorPosts
- April 1, 2022 at 10:54 am #49369Zach GunyanGuest
Good Evening;
We have an issue using Crio Theme with WooCommerce, where the quantity buttons ( – + ) are incrementing by two instead of by one, so as you hit the + button, it goes from 1 to 3 to 5 to 7 and so on, and the Minus sign goes back by the same increments.
I appreciate any assistance you can provide to me on this issue!
April 1, 2022 at 11:03 am #49409Brandon CKeymasterHi Zach,
Thanks so much for reaching out and thank you for using Crio Pro WordPress theme!
It’s seems the increments of your button counter have somehow been changed to increase by two but I can assure you that functionality is not relative to the Crio theme. It’s possible WooCommerce is inheriting the functionality from a WooCommerce setting configuration or a 3rd Party plugin.
I tried recreating your error in my own instance of Crio unsuccessfully but I did manage to find a code snippet that allowed me to manipulate that WooCommerce functionality and set my own increments. In order to add the snippet you’ll need to install and activate the Code Snippets plugin, add a new snippet, then copy/paste the code below. Be sure to scroll down and click Save and Activate after adding the snippet.
Here’s the code snippet:
/**
* Adjust the quantity input values
*/
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); // Simple productsfunction jk_woocommerce_quantity_input_args( $args, $product ) {
if ( is_singular( 'product' ) ) {
$args['input_value'] = 1; // Starting value (we only want to affect product pages, not cart)
}
$args['max_value'] = 80; // Maximum value
$args['min_value'] = 1; // Minimum value
$args['step'] = 1; // Quantity steps
return $args;
}add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations
function jk_woocommerce_available_variation( $args ) {
$args['max_qty'] = 80; // Maximum value (variations)
$args['min_qty'] = 1; // Minimum value (variations)
return $args;
}I hope this helps! Please reach back out if there’s anything else that we can answer for you.
- AuthorPosts
- The topic ‘Issue with WooCommerce button quantity increment in Crio WordPress theme’ is closed to new replies.