Product Page

WooCommerce Set Minimum Product Quantity For All Products

WooCommerce minimum product quantities

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

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;
}

Snippet Benefits

  • Increase your Average Order Value (AOV) by forcing a minimum product quantity before it can be added to the cart.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.

26027
WELCOME OFFER