This tutorial will show you how to set the minimum and/or maximum quantity in WooCommerce. We’ll also look at several other neat features around quantity – e.g. setting different step values and default quantities.
There are many reasons for wanting to set min max quantity rules in WooCommerce:
- Wholesale stores might wish to limit the number of items a customer can purchase in one order
- Stores with limited stock might wish to ensure that as many customers as possible have the chance to purchase products
- Stores with tight margins might require customers to purchase a minimum number of items
As well as setting minimum and maximum quantity in WooCommerce, there is some other functionality around quantities that you might need. For instance:
- If you’re selling items in certain pack sizes, e.g. in 6s for bottles of wine, then you may want to ensure that users can’t purchase in any other multiple
- You might want to set a different default quantity: WooCommerce always sets the default quantity for a product to 1 – but you might want to start at 5
- It might even be that you want to give your customers the ability to pick quantities from a dropdown list (select field) rather than using the standard number input. And you might wish to display text as part of the options rather than just numbers.
We’ll take a look at all these items in this article. You can also see examples of the different functionality in this demo site.
In order set minimum maximum quantities, you’ll need the WooCommerce Minimum Maximum Quantity and Order plugin.
How to set minimum and maximum quantity in WooCommerce
The WooCommerce Minimum Maximum Quantity and Order plugin is extremely flexible and allows you to set quantity rules in a number of ways:
- Globally – set min/max rules that apply to all products in your store. You can set minimum and maximum rules to apply per product or to the entire order
- Rules – create rules that will apply to multiple products, e.g. by category, attribute or by product ID
- Product level – set specific min max rules for individual products
- Variation level – set specific min max rules for individual variations
The plugin’s rules “cascade” – meaning that if you set a rule at product level, this will override rules set globally or on multiple products.
Setting a minimum maximum quantity rule globally
Let’s start by setting a global quantity rule. Once you’ve installed and activated the plugin, go to WooCommerce > Settings > Min Max. You’ll see a number of settings. For now, let’s concentrate on the settings that relate to quantity.
You can set minimum and maximum quantities for the entire order. Enter values in the ‘Minimum Order Quantity’ and ‘Maximum Order Quantity’ fields. This will total up the quantity of all items in the customer’s cart and prevent them from checking out if the quantity rules aren’t met. So for example, if you enter 20 as the minimum order quantity, the customer must have a total of 20 items in their cart.
Global Product Settings
You can also set global quantity rules for each product – so the values you define here will apply to every product in the store (unless you set a more specific rule, more below). You can enter values for ‘Minimum Quantity’ and ‘Maximum Quantity’. So if you enter 10 as the minimum quantity, the customer will need to buy at least 10 of each item in their cart.
Setting minimum and maximum quantity rules for multiple products in WooCommerce
If you don’t want to set global rules for min max quantities (or if you want to override the global rules with more specific rules), you can set quantity rules for multiple products.
Go to WooCommerce > Min Max Rules and click ‘Add New’. You’ll see a new page where you can add various settings for your rule.
Rule Applies To
In the first section, you can define where the rule will apply:
- Applies To: choose from ‘All Products’, ‘Selected Attributes’, ‘Selected Categories’, ‘Selected Products’
- If you choose an option other than ‘All Products’, you’ll see a further field where you can enter the attributes, categories or products where you want the rule to apply
- In ‘Excluded Products’ you can define specific products that should be excluded from the rule. This means you could specify a category but still exclude certain products from within that category
- ‘Role’: enter any specific user roles where the rule should apply. This is especially useful in a wholesale or B2B store where different quantity rules might apply to different types of customer
- ‘Combine products’ – see below
The ‘Combine products’ setting
‘Combine products’ is available when you choose ‘Selected Categories’. It allows you to decide whether to apply rules to each product in the category individually or collectively. So if you set a minimum quantity of 10 and you select the ‘Combine products’ option, the user can add multiple products to their cart from this category and the combined quantity of those products must be 10 or more.
If you deselect the option, then the rule will apply to the individual quantity of each product in the category. So each product from the category would have a minimum quantity of 10.
Here you can specify the minimum and maximum quantities that will apply to each product defined in your rule. So if you enter 5 in the ‘Minimum Quantity’ field, the customer will be required to purchase a minimum of 5 items for any product covered by this rule that they add to their cart.
Any values entered here will take priority over global rules. You can add as many rules as you like – so you can define different minimum and maximum quantities for different products, categories and attributes.
There are some other quantity-related settings in this section. We’ll cover them below.
Setting minimum and maximum quantity rules for individual WooCommerce products
If you want to create minimum and maximum quantity rules per product, you can do so directly from the ‘Product data’ section of the product.
Just enter your minimum and maximum values in the fields indicated. Any values entered at product level will override global rules and rules set on multiple products.
Setting minimum and maximum quantity rules for individual WooCommerce variations
And if you want to create minimum and maximum quantity rules per variation, you can do so directly from the variation fields.
Note that you can still set product-level rules, as above, which will apply by default to all variations in the product. If you need some variations to have different rules, you just set those at variation-level.
So, as well as setting how to set minimum and maximum quantities, hopefully now you can see how the WooCommerce Minimum Maximum Quantity and Order plugin allows you to set rules in multiple ways:
- For multiple products
- For individual products
- For variations
We’ll look at some other settings now.
Setting the default quantity in WooCommerce
As I mentioned above, WooCommerce sets the default quantity on all products to 1. The default quantity is the value in the quantity field when the user first opens the page. Using the WooCommerce Minimum Maximum Quantity and Order plugin, you can change this default. In the example below, the default quantity is 3. You can see the demo product here.
If you set a minimum quantity rule on a product then it will automatically set the default quantity to that value. So if the minimum quantity for the product is 3, then the default quantity will be 3. But you can still set the default quantity to a different value if you wish. Perhaps you want to encourage users to add more products to the cart? Just set the default quantity to more than one.
You can set the default quantity globally, on multiple products, and at product and variation level. See the section on minimum and maximum quantities above for a description of each level. The screenshot below shows how to set the default quantity at product level.
Setting the quantity increment (step value) in WooCommerce
As with the default quantity above, WooCommerce sets the quantity step value to 1. The step value is how much the quantity increases or decreases if you use the plus/minus buttons. Check out this product for a working example – the step value is adjusted by 2.
Having a default of 1 is fine for most products but what if you want to ensure that customers order your products in certain multiples? Maybe you sell in boxes of 5, or 100, or 1000.
You can set your own step value by entering a value in the ‘Quantity Increment’ field. You can set this globally, by multiple products, or at individual product and variation level. The image below shows a product level setting.
Displaying quantities in a dropdown field
In certain circumstances, you might want to allow the user to select the quantity from a dropdown (select) field instead of from a number input. This works well if you have a limited range of quantities that the user can select – e.g. from 1 to 10. There’s an example here.
To display your quantity field as a dropdown list, check the ‘Display as Dropdown’ option. This can be set for all products (globally), for multiple products, or for individual products. Note that you’ll need to set a maximum quantity as well in order to ensure the list isn’t infinite.
If you have set a quantity increment (step value), the dropdown list will take account of this. So if your increment is 2 and the min max values are 2 and 10, the dropdown list will display 2, 4, 6, 8, 10.
Non-linear quantities in WooCommerce
Let’s say your product is only sold in certain quantities. For example, you sell items singly, in boxes of 5, or in boxes of 20, or in boxes of 100. Take a look at this product as an example. WooCommerce doesn’t allow you to define custom quantities but with this plugin it’s easy.
In the ‘Defined Quantities’ field, enter your list of quantities. If you wish, you can also include text in the list. Enter the quantity value first, then any text after a ‘|’ symbol. Enter each value on a new line, e.g.:
The values you enter will automatically be rendered as a dropdown list.
So that’s how to set the min max quantity in WooCommerce for products and variations. Let’s take a quick look at how this plugin integrates with other Plugin Republic products.
Setting minimum and maximum quantities in WooCommerce – video
Take a look at the video below for a walkthrough on the topics covered above.
WooCommerce Minimum Maximum Quantity and Order is compatible with all Plugin Republic products. We’ll look at two in particular.
WooCommerce Product Table Ultimate
Product Table Ultimate allows you to list your products in a table format. One great advantage of this is that your users can add multiple products to their cart from a single page, making ordering much simpler.
You can use the Minimum Maximum Quantity and Order plugin to set min and max quantity rules for products in the table. You can also set different default quantity values for products.
As you can see from the demo product and the screenshot above, Product Table Ultimate respects the settings of Minimum Maximum Quantity and Order. So you can set min max quantity rules, different default and step values, and even display quantity fields as dropdowns in your product table.
WooCommerce Better Variations
One of the features of WooCommerce Better Variations is that it allows you to display variations in a bulk order form.
This means that users can select quantities for multiple variations from a grid, rather than having to select each variation separately. With the WooCommerce Minimum Maximum Quantity and Order plugin, you can ensure that your min max quantities and default and step values are respected.
Here’s a link to a demo product.
Setting the min max quantity in WooCommerce – recap
So, that’s how to set minimum and maximum quantities in WooCommerce. We looked at setting values globally, using rules that cover multiple products, or at product or variation level.
We also looked at how you can set different default quantity values for your products, set different step or increments, display quantity fields as dropdowns, and even create non-sequential quantities for your products. In short, the Minimum Maximum Quantity and Order plugin gives everything you need for advanced quantity functionality in WooCommerce.