Last active
November 9, 2018 10:42
-
-
Save wooexperte/73058cd648da8a78e903d937edee1a16 to your computer and use it in GitHub Desktop.
WooCommerce Stückzahl - Mindeststückzahl - Höchststückzahl - Mengenschritte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WooCommerce Stückzahl - Mindeststückzahl - Höchststückzahl - Mengenschritte | |
*/ | |
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 ); // Einfache Produkte | |
function jk_woocommerce_quantity_input_args( $args, $product ) { | |
if ( is_singular( 'product' ) ) { | |
$args['input_value'] = 2; // Start Stückzahl | |
} | |
$args['max_value'] = 20; // Höchststückzahl | |
$args['min_value'] = 2; // Mindeststückzahl | |
$args['step'] = 2; // Mengenschritte | |
return $args; | |
} | |
add_filter( 'woocommerce_available_variation', 'jk_woocommerce_available_variation' ); // Variable Produkte | |
function jk_woocommerce_available_variation( $args ) { | |
$args['max_qty'] = 20; // Höchststückzahl (Variable Produkte) | |
$args['min_qty'] = 2; // Mindeststückzahl (Variable Produkte) | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment