Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wooexperte/73058cd648da8a78e903d937edee1a16 to your computer and use it in GitHub Desktop.
Save wooexperte/73058cd648da8a78e903d937edee1a16 to your computer and use it in GitHub Desktop.
WooCommerce Stückzahl - Mindeststückzahl - Höchststückzahl - Mengenschritte
/**
* 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