This guide shows you how you can globally set a minimum product quantity across all products in your store. Minimum product quantities are a great way of increasing your Average Order Value (AOV) because the customer must add more than one of your products to their cart. This guide would be useful products where shipping just one isn’t practical in terms of your store making a profit. Perhaps you sell frozen goods and need to enforce a minimum quantity to ensure the package stays frozen during transit. This particular solution only forces a minimum quantity and does not affect the step quantity. For example, if you set a minimum quantity of 10, the customer is still able to buy 11 of your products but there must be a minimum of 10. We have published a guide on changing the step quantity too, go ahead and check it out if your business requires this functionality.
/**
* Snippet Name: WooCommerce Set Minimum Product Quantity For All Products
* Snippet Author: ecommercehints.com
*/
add_filter( 'woocommerce_quantity_input_args', 'ecommercehints_minimum_product_quantity_input_step', 10, 2 ); // Simple products
function ecommercehints_minimum_product_quantity_input_step( $args, $product ) {
$minimum_quantity = 10; // The minimum quantity you'd like to set
if ( is_singular( 'product' ) ) {
$args['input_value'] = $minimum_quantity;
}
$args['min_value'] = $minimum_quantity;
return $args;
}
add_filter( 'woocommerce_available_variation', 'ecommercehints_minimum_variation_quantity' ); // Product variations
function ecommercehints_minimum_variation_quantity( $args ) {
$args['min_qty'] = $minimum_quantity;
return $args;
}