Guest User

Untitled

a guest
Oct 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. /**
  2. * Adjust the quantity input values
  3. */
  4. add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); // Simple products
  5.  
  6. function jk_woocommerce_quantity_input_args( $args, $product ) {
  7. if ( is_singular( 'product' ) ) {
  8. $args['input_value'] = 2; // Starting value (we only want to affect product pages, not cart)
  9. }
  10. $args['max_value'] = 80; // Maximum value
  11. $args['min_value'] = 2; // Minimum value
  12. $args['step'] = 2; // Quantity steps
  13. return $args;
  14. }
  15.  
  16. add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variations
  17.  
  18. function jk_woocommerce_available_variation( $args ) {
  19. $args['max_qty'] = 80; // Maximum value (variations)
  20. $args['min_qty'] = 2; // Minimum value (variations)
  21. return $args;
  22. }
Add Comment
Please, Sign In to add comment