14,000+ Active Installs
4,97 Star Review Average

WooCommerce Minimum Order - Quantity and Amount

November 3, 2020

In this article we will explore how to set a minimum order quantity or minimum order amount in your WooCommerce store. You can do this with our premium plugin, B2BKing, by creating dynamic rules.

The plugin enables minimum order rules per product or per category, for all users, individual users, or specific groups. You can thus have different minimum order values for different customers (a common setup for b2b or wholesale stores).

Minimum Order Quantity

Let's first of all look at how to set a minimum order quantity. You can try everything out for yourself in our plugin demo to see exactly how it works.

Go to B2BKing->Dynamic Rules and create a New Rule.

Example rule: minimum order 500 wine items

In our example above, we have created a rule, that applies to the "Wines" category, for users in the "Resellers" group, of minimum 500 items.

If users try to purchase anything less, they will see the following error in cart, and will not be able to checkout:

In the checkout page, depending on your theme, users are prompted to resolve the issues in cart:

It's very simple to set up, and it can be set up for products or categories, for users or groups in all sorts of combinations. You can even create a minimum quantity rule for a specific product variation (for WooCommerce variable products).

Example 2

Cabernet Sauvignon 2018 can be purchased in minimum 5 bottles by all users. Here's what the configuration looks like:

The rule will apply to only this specific product, which can now be purchased in minimums of 5. If they try to purchase any less, users will see the following error:

This functionality is different from required package/box quantity. Scroll down below to find out how to set items to be purchasable in multiples of X.

Minimum Order Amount / Value

To set minimum order value, you can use the same system and simply choose "Value" instead of "Quantity" in the dynamic rule dropdown.

Let's see an example: setting a minimum order for all B2B users of $2000.

This is the configuration:

And the result in the cart page:

Notice that the previous notification about minimum orders of 5 is still present as well. Multiple minimum rules can be stacked and checkout will only be allowed when all the purchase conditions are met by the customer.

Set Required Multiple / Package Quantity

Another common requirement in wholesale e-commerce is selling certain items in multiples of X (6 in a box, carton of 12, etc). You can do this with B2BKing's "Required Multiple" rule. This rule will only allow customers to purchase certain products in multiples of the chosen number.

Let's see an example: the following item is purchasable only in multiples of 6, since that's the box size:

If the user tries to purchase for example 8, they will see the following error in cart:

This rule also supports Conditions. For example you can set that this rule applies only for orders over 100 items. So if the customer wants to purchase below 100, they can do so in any multiple, but if they are placing a larger order, in that case their purchase must follow box size rules. Below is how this can be configured:

Payment Method Minimum Order

Another functionality in the plugin is Minimum Order to use a particular payment method or gateway. For example, you can enable Bank Transfers only for orders above $5000.

This is very simple to set up, simply create a new Dynamic rule with a configuration like this:

Customers will not see this method at all in checkout, until their purchase is over the $5000 threshold.

Maximum Order - Limit Quantity or Value

Besides minimum order rules, the plugin also supports maximum order rules. For example, if you have customers that are new and you do not have a well-established relationship with them, you can place them in a group that has a maximum order quantity or value.

In the example above, users in the "Factories" group, can purchase items in the "Computers" category for a maximum of $10000. If they attempt to purchase more, they will not be able to checkout.

Set Minimum Purchase with Code Snippets

Finally, if you are a developer or if you are familiar with coding, we would like to share some code snippets and ways to set this up in WooCommerce.

add_action( 'woocommerce_checkout_process', array('B2bking_Dynamic_Rules', 'b2bking_dynamic_minmax_order_amount') );
									add_action( 'woocommerce_before_cart' , array('B2bking_Dynamic_Rules', 'b2bking_dynamic_minmax_order_amount'));

As you can see above, the 2 WooCommerce hooks you need to use are woocommerce_checkout_process and woocommerce_before_cart, so that conditions are checked in both cart and checkout.

Inside the function itself, the code looks like this:

function b2bking_dynamic_minmax_order_amount(){

	// first of all, calculate the value or quantity in cart
	$cart = WC()->cart;
	$cart_total = 0;
	$cart_quantity = 0;
	$limit = 2500; // example limit
	foreach($cart->get_cart() as $cart_item){
        $cart_quantity += $item_qty; // ctotal number of
        $cart_total += $item_line_total; // calculated total items amount

	if ( $cart_total > intval($limit) ) {
	    if( is_cart() ) {
	            sprintf( esc_html__('Your current order quantity total of %s is %s — the maximum quantity you can order is %s ','b2bking') , 
	            ), 'error' 
	    } else {
	            sprintf( esc_html__('Your current order quantity total of %s is %s — the maximum quantity you can order is %s ','b2bking') , 
	            ), 'error' 
B2BKing is a product made with passion by SNP Digital, that we are constantly developing, supporting and improving.

Buy B2BKing


$199 $139

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram