Skip to content

Instantly share code, notes, and snippets.

@spraveenitpro
Last active August 29, 2015 14:23
Show Gist options
  • Save spraveenitpro/1db005951274ef51779d to your computer and use it in GitHub Desktop.
Save spraveenitpro/1db005951274ef51779d to your computer and use it in GitHub Desktop.
Setup Step, min and max for Simple and Variable products
// Simple products
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 );
function jk_woocommerce_quantity_input_args( $args, $product ) {
$args['input_value'] = 3; // Starting value
$args['max_value'] = 12; // Maximum value
$args['min_value'] = 3; // Minimum value
$args['step'] = 3; // Quantity steps
return $args;
}
// Variations
add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' );
function jk_woocommerce_available_variation( $args ) {
$args['max_qty'] = 12; // Maximum value (variations)
$args['min_qty'] = 3; // Minimum value (variations)
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment