Differentiation of Woocommerce Quantity Input Value by Category [closed]
Question
In Woocommerce, I check the minimum quantity of my products and the increasing steps with the code below. Now I have decided to work with different product categories, and this code that I applied to the entire site is not suitable for new products. How can I differentiate the values by category?
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 );
function jk_woocommerce_quantity_input_args( $args, $product ) {
if ( is_singular( 'product' ) ) {
$args['input_value'] = 100; // Starting value (we only want to affect product pages, not cart)
}
$args['max_value'] = 10000; // Maximum value
$args['min_value'] = 100; // Minimum value
$args['step'] = 50; // Quantity steps
return $args;
}
// Variations
add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' );
function jk_woocommerce_available_variation( $args ) {
$args['max_qty'] = 10000; // Maximum value (variations)
$args['min_qty'] = 100; // Minimum value (variations)
return $args;
}
0
2 years
2020-12-18T08:10:46-05:00
2020-12-18T08:10:46-05:00 0 Answers
8 views
0
Leave an answer