You can limit purchase quantity in WooCommerce with the built-in Sold individually box, a free min max plugin or a short code snippet. Pick the method by the rule you need: a cap per product, per order or per customer.
We tested five of the six methods on a WooCommerce 11.2 test store with WordPress 7.1 in October 2026. For each we pushed past the limit on the product page, in both carts and at checkout, and captured the shopper’s error. The paid extension is covered from its documentation.
You will see what each kind of limit counts and how to set up each method step by step. A table at the end matches the method to your rule, followed by the checks to run before a limit goes live.
What Can You Limit in WooCommerce?
WooCommerce limits count one of three things: one product in an order, the whole cart or one customer over time. Core WooCommerce ships only one control for this, the Sold individually box. Every other kind of limit needs a plugin or a code snippet.
Decide which kind you need before you pick a tool. A coffee roaster might sell espresso beans in 2 to 5 bags per order. A limited hot sauce batch might allow 6 bottles per customer every 30 days.

Minimums matter as much as maximums. A cheap item that costs more to pack than it earns can carry a minimum of 2. A maximum protects stock during a launch and stops one buyer from clearing the shelf.
A fourth kind sits on top of these: the step. Some stores sell only in packs of 6, and the quantity must be a multiple of 6. Only the paid extension and paid plugin versions in our tests offered that.
Strictness matters too. A quantity box with a maximum is only a hint, because a shopper can edit the page in the browser. A real rule is checked on the server, and our tests below show which methods do that and where.
Method 1: Turn On Sold Individually
Sold individually is the one built-in quantity limit in WooCommerce. It lets a customer buy one unit of a product per order and removes the quantity box from the product page. Use it for memberships, signed prints, one-off services and other items that make no sense in twos.
The WooCommerce product editor documentation states that the option “does not prevent customers from making multiple orders” of the same item. So it caps one order and never the customer.
- Open the product: Go to
Products > All Productsand click the product you want to limit. - Tick the box: Open the Inventory tab and tick “Limit purchases to 1 item per order” next to Sold individually. Then click Update.

- Test it as a shopper: Add the product to the cart, go back to the product page and click Add to cart again.
On our test store the product page showed no quantity box at all. The second add returned the notice “You cannot add another “Signed Art Print” to your cart” with a View cart link.

Note: Sold individually is all or nothing. It cannot allow 3 units or require a minimum of 2. Use Method 2 or Method 4 for any number other than one.
Method 2: Set WooCommerce Min Max Quantity With a Free Plugin
A free plugin is the fastest way to set a WooCommerce min max quantity on each product without code. We used Min and Max Quantity for WooCommerce by BeRocket, the most-installed maintained plugin for this job on WordPress.org. It adds Minimum Quantity and Maximum Quantity fields to every product’s Inventory tab.
Its WordPress.org listing showed 20,000+ active installations, version 3.1.3 and testing up to WordPress 7.1.3 as of October 2026. The free version covers limits on products, variations and the whole cart. Category, attribute and group limits are in the paid version.
- Install the plugin: Go to
Plugins > Add Plugin, search for “Min and Max Quantity for WooCommerce” and click Install Now. Then click Activate. - Set the product limits: Edit the product, open the Inventory tab and fill in Minimum Quantity and Maximum Quantity. We used 2 and 5 for a bag of espresso beans. Click Update.

- Turn on Prevent add to cart: Go to
BeRocket > Min/Max Quantitiesand tick Prevent add to cart. The Cart products quantity fields on the same screen cap the total units in an order. Click Save Changes.
Step 3 matters more than it looks, and our test shows why. With the plugin’s default settings, we forced 6 bags through the product form.
The plugin printed its error and still added all 6 to the cart.
The Cart block then showed “Please fix the following error before continuing” above the line. Our checkout request for that cart was refused with the same message. The order never went through.

The limit holds, but the shopper meets it late. After we ticked Prevent add to cart, the over-limit add never reached the cart. Adding 3 bags and then 3 more stopped at 3 with “Quantity of product Espresso Beans 1kg can not be more than 5”.

The cart cap worked the same way. We set Cart products quantity to a maximum of 4 and put 3 mugs in the cart. Adding 2 bags returned “Quantity of products in cart must be 4 or less”.
One quirk stayed. The plugin does not put its limits on the quantity box. On our product page the box still started at 1 with no maximum.
Shoppers only learn the rule from the error notice. Mention the limit in the product description so nobody is surprised.
Method 3: Use the Official Min/Max Quantities Extension
The official Min/Max Quantities extension is the paid WooCommerce.com option for quantity rules. It sets a minimum, a maximum and a “Group of” multiple per product, per variation, per category and per order. It costs $49 a year on WooCommerce.com as of October 2026, with a 30-day money-back guarantee.
The Min/Max Quantities documentation puts product rules under Product Data > General > Quantity Rules. Order rules live in WooCommerce > Settings > Products > General as a Minimum Order Quantity and a maximum quantity per order. The same screen also takes a minimum and maximum order value.

Two settings are worth reading before you buy:
- Group of: Forces a product to sell in multiples, such as packs of 6. The free plugin above has no step setting in its free version.
- Combine Variations: Applies one rule across all variations of a variable product. The docs say these rules are “validated in the cart/checkout pages only”. Shoppers see the error later in the flow.
The extension also has a REST API side. The docs list error codes such as woocommerce_rest_invalid_min_quantity for orders created through the API, which matters for stores that take orders from apps.
We covered this extension from its documentation and did not buy a license for this guide. It fits stores that need category rules or pack sizes without writing code. For one range per product, the free plugin in Method 2 did the same job on our store.
Method 4: Limit Purchase Quantity in WooCommerce With Code
You can limit purchase quantity in WooCommerce with about 100 lines of PHP that give each product its own range. The code sets the limits on the quantity box, refuses a bad add to cart and checks the whole cart before checkout. It works with the classic cart and the Cart and Checkout blocks.
Add it to a child theme’s functions.php or a code snippets plugin, never to a parent theme file. Our guide to creating a WordPress child theme shows the safe setup. Every product name in a message passes through esc_html() before it is shown.
The first block holds the rules and two helpers. Change the product IDs and numbers in mystore_qty_rule() to match your store:
/**
* Per-product rules. Format: product ID => array( minimum, maximum ).
* A variation uses the rule of its parent, so all sizes share one limit.
*/
function mystore_qty_rule( $product ) {
$rules = array(
12 => array( 2, 5 ), // Ceramic Coffee Mug.
39 => array( 1, 3 ), // Logo T-Shirt, every size together.
);
$id = $product->get_parent_id() ? $product->get_parent_id() : $product->get_id();
return isset( $rules[ $id ] ) ? $rules[ $id ] : null;
}
// Units of one product already in the cart, all variations included.
function mystore_qty_in_cart( $product_id, $skip_key = '' ) {
$units = 0;
if ( ! WC()->cart ) {
return $units;
}
foreach ( WC()->cart->get_cart() as $key => $item ) {
if ( $key !== $skip_key && (int) $item['product_id'] === (int) $product_id ) {
$units += (int) $item['quantity'];
}
}
return $units;
}
// Returns an error message when a total breaks the rule, or an empty string.
function mystore_qty_error( $product, $total ) {
$rule = mystore_qty_rule( $product );
if ( ! $rule ) {
return '';
}
$name = esc_html( $product->get_parent_id() ? wc_get_product( $product->get_parent_id() )->get_name() : $product->get_name() );
if ( $total > $rule[1] ) {
/* translators: 1: product name, 2: maximum quantity. */
return sprintf( __( 'You can buy up to %2$d of %1$s per order.', 'mystore' ), $name, $rule[1] );
}
if ( $total < $rule[0] ) {
/* translators: 1: product name, 2: minimum quantity. */
return sprintf( __( 'The minimum order for %1$s is %2$d.', 'mystore' ), $name, $rule[0] );
}
return '';
}
The second block puts the limits on the quantity box. The WooCommerce Store API source builds its own limits from the same woocommerce_quantity_input_args filter. That is why the Cart block follows it with no extra code:
// 1. Put the limits on the quantity field. The block cart reads the same values.
add_filter( 'woocommerce_quantity_input_args', function ( $args, $product ) {
$rule = mystore_qty_rule( $product );
if ( $rule ) {
$args['min_value'] = $rule[0];
$args['max_value'] = $rule[1];
if ( isset( $args['input_value'] ) && $args['input_value'] < $rule[0] ) {
$args['input_value'] = $rule[0];
}
}
return $args;
}, 10, 2 );
// Same limits on the field once a shopper picks a variation.
add_filter( 'woocommerce_available_variation', function ( $data, $product, $variation ) {
$rule = mystore_qty_rule( $variation );
if ( $rule ) {
$data['min_qty'] = $rule[0];
$data['max_qty'] = $rule[1];
}
return $data;
}, 10, 3 );
The third block is the real lock on add to cart and on the classic cart’s Update cart button:
// 2. Refuse an add to cart that would break the rule.
add_filter( 'woocommerce_add_to_cart_validation', function ( $passed, $product_id, $quantity, $variation_id = 0 ) {
$product = wc_get_product( $variation_id ? $variation_id : $product_id );
if ( ! $product ) {
return $passed;
}
$error = mystore_qty_error( $product, mystore_qty_in_cart( $product_id ) + (int) $quantity );
if ( $error ) {
wc_add_notice( $error, 'error' );
return false;
}
return $passed;
}, 10, 4 );
// 3. Refuse a quantity change in the classic cart that would break the rule.
add_filter( 'woocommerce_update_cart_validation', function ( $passed, $cart_item_key, $values, $quantity ) {
$total = mystore_qty_in_cart( $values['product_id'], $cart_item_key ) + (int) $quantity;
$error = mystore_qty_error( $values['data'], $total );
if ( $error ) {
wc_add_notice( $error, 'error' );
return false;
}
return $passed;
}, 10, 4 );
The fourth block checks the whole cart on the cart page, at checkout and on every Store API checkout request:
// 4. Check the whole cart before checkout. This also covers the block cart and checkout.
add_action( 'woocommerce_check_cart_items', function () {
$seen = array();
foreach ( WC()->cart->get_cart() as $item ) {
$product_id = (int) $item['product_id'];
if ( isset( $seen[ $product_id ] ) ) {
continue;
}
$seen[ $product_id ] = true;
$error = mystore_qty_error( $item['data'], mystore_qty_in_cart( $product_id ) );
if ( $error ) {
wc_add_notice( $error, 'error' );
}
}
} );
We ran all four blocks on the test store with a Ceramic Coffee Mug set to 2 to 5. The product page quantity box started at 2 and stopped at 5. Forcing 6 through the form returned “You can buy up to 5 of Ceramic Coffee Mug per order” and added nothing.

The classic cart refused an edit from 3 to 9 units with the same message. The quantity stayed at 3.

In the Cart block, the plus button greyed out at 5. Direct Store API requests for 9 units and for 1 unit came back as 400 errors. They named the maximum of 5 and the minimum of 2.

The fourth block earned its place on a variable product. Our Logo T-Shirt had a cap of 3 across all sizes. The Cart block still let us raise Small to 3 while Large sat at 1, because each line only knows its own maximum.
With the fourth block in place, block checkout showed “You can buy up to 3 of Logo T-Shirt per order” and refused the order. We removed the fourth block and placed the same order. It went through with 4 shirts.

Warning: Snippets that only use woocommerce_add_to_cart_validation leave this gap open. Always keep a woocommerce_check_cart_items check when a limit spans variations or can change in the cart.
If your rules depend on roles, order totals or stock levels, our WooCommerce development services team can build and test them as a small plugin.
Method 5: Limit Quantity Per Customer Over Time
A rule that limits quantity per customer counts earlier orders as well as the cart. A shopper who bought 4 bottles this month can add only 2 more under a cap of 6. WooCommerce has no setting for it, and the rule needs code or a plugin plus a logged-in customer.
The snippet below uses wc_get_orders() with the customer_id, status and date_created arguments from the WC_Order_Query reference. It counts processing, on-hold and completed orders inside a day window. Paste it below the Method 4 code, because it reuses mystore_qty_in_cart():
/**
* Per-customer caps. Format: product ID => array( maximum units, days ).
* Days = 0 counts every order the customer ever placed.
*/
function mystore_customer_cap( $product_id ) {
$caps = array(
13 => array( 6, 30 ), // Limited Batch Hot Sauce: 6 per customer every 30 days.
);
return isset( $caps[ $product_id ] ) ? $caps[ $product_id ] : null;
}
// Units of one product the customer bought in paid or pending orders.
function mystore_units_bought( $user_id, $product_id, $days ) {
$args = array(
'customer_id' => $user_id,
'status' => array( 'wc-processing', 'wc-on-hold', 'wc-completed' ),
'limit' => -1,
);
if ( $days ) {
$args['date_created'] = '>' . ( time() - $days * DAY_IN_SECONDS );
}
$bought = 0;
foreach ( wc_get_orders( $args ) as $order ) {
foreach ( $order->get_items() as $item ) {
if ( (int) $item->get_product_id() === (int) $product_id ) {
$bought += (int) $item->get_quantity();
}
}
}
return $bought;
}
// Returns an error when the cart would push a customer past the cap.
function mystore_customer_error( $product_id, $in_cart ) {
$cap = mystore_customer_cap( $product_id );
if ( ! $cap ) {
return '';
}
$name = esc_html( get_the_title( $product_id ) );
if ( ! is_user_logged_in() ) {
/* translators: 1: product name, 2: maximum per customer. */
return sprintf( __( 'Please log in to buy %1$s. It is limited to %2$d per customer.', 'mystore' ), $name, $cap[0] );
}
$bought = mystore_units_bought( get_current_user_id(), $product_id, $cap[1] );
if ( $bought + $in_cart > $cap[0] ) {
/* translators: 1: product name, 2: maximum per customer, 3: units already bought. */
return sprintf( __( '%1$s is limited to %2$d per customer. You have already bought %3$d.', 'mystore' ), $name, $cap[0], $bought );
}
return '';
}
add_filter( 'woocommerce_add_to_cart_validation', function ( $passed, $product_id, $quantity ) {
$error = mystore_customer_error( $product_id, mystore_qty_in_cart( $product_id ) + (int) $quantity );
if ( $error ) {
wc_add_notice( $error, 'error' );
return false;
}
return $passed;
}, 20, 3 );
add_action( 'woocommerce_check_cart_items', function () {
foreach ( WC()->cart->get_cart() as $item ) {
$error = mystore_customer_error( $item['product_id'], mystore_qty_in_cart( $item['product_id'] ) );
if ( $error ) {
wc_add_notice( $error, 'error' );
return;
}
}
} );
To test it, we gave a customer two completed orders of 2 bottles each in the last 30 days. We also added one order of 3 bottles from 60 days ago. The snippet counted 4 bottles and ignored the old order.
The customer could add 2 more bottles. An add of 3 returned “Limited Batch Hot Sauce is limited to 6 per customer. You have already bought 4.”

Guests are refused with “Please log in to buy Limited Batch Hot Sauce”. A guest has no order history to count, and an open door would let anyone check out again under a new email.
The code loads every matching order on each add to cart. That is fine for a store where a customer has dozens of orders, and slow for one with thousands.
For a plugin route, the free Maximum Products per User plugin by WPFactory showed 1,000+ installs and testing up to WordPress 7.0.7 in October 2026. In its free settings, one “All products” limit applies to every product. The per-product, tag and category limit boxes are locked to the paid version.
Method 6: Cap Pre-Orders With Our Pre-Order Plugin
If the limited product is a pre-order, the WooCommerce Pre-Order plugin can cap it per order and per customer without code. We build this plugin and list it after the general methods for that reason. It only limits products set up as pre-orders and does not replace Methods 1 to 5 for normal stock.
We tested the Pro version 2.0.0 of the WooCommerce Pre-Order plugin, which lists from $79 a year on our store in October 2026. Each pre-order product has a Max Quantity Per Order and a Max Quantity Per Customer field. A default for both sits under Pre-Order > Configuration > Checkout.
- Open the pre-order product: Go to
DevDiggers Plugins > Pre-Order > Productsand edit the product, or click Add New to create one. - Set the two limits: Enter a Max Quantity Per Order and a Max Quantity Per Customer. We used 2 and 4 for a Holiday Blend Coffee launch. Click Save.

A guest who tried to reserve 3 bags saw “You can reserve up to 2 of Holiday Blend Coffee in one pre-order”. A logged-in customer already held two pre-orders of 2 bags. A fifth bag returned “You can reserve up to 4 of Holiday Blend Coffee across your pre-orders”.

There are limits to know about. The per-customer cap counts logged-in customers only, the same as Method 5.
On our block theme the product page showed the plugin’s Pre-Order form above the theme’s own Add to cart form. The quantity box also carried no maximum. Shoppers learn the cap from the notice.
Compare other options in our list of the best WooCommerce pre-order plugins.
Which Method Should You Choose?
The best way to limit purchase quantity is the simplest method that covers your rule. Use Sold individually for one per order, the free plugin for a range per product and code when a rule spans variations or customers. Mix methods only when each one covers a different product.
| Need | Sold individually | Free plugin | Official extension | Code |
|---|---|---|---|---|
| One unit per order | Yes | Yes | Yes | Yes |
| Min and max per product | No | Yes | Yes | Yes |
| Cap on total items in an order | No | Yes | Yes | Add a rule |
| Rules by category or pack size | No | Paid version | Yes | Add a rule |
| Limit per customer over time | No | No | No | Yes (Method 5) |

Two methods can run side by side on one store. A shop selling licenses might use Sold individually on software and the free plugin on physical goods. A drop store might pair Method 4 with the per-customer cap from Method 5.
Speed is the other trade-off. The per-customer code reads order history on every add to cart. Test it on a copy of your real order table before launch.
If you only want to stop shoppers from editing the quantity after they add a product, read how to lock the WooCommerce cart quantity. That changes the cart and does not cap units.
How to Test Your Quantity Limits
A quantity rule is done only when you have tried to break it on a staging copy. Test as a guest and as a logged-in customer, on the product page, in the cart and at checkout. Then repeat on one variable product, because variations are where most limits leak.
Here is a worked example with round numbers. Say your cap is 5 per order. A shopper adds 3 units and then tries to add 3 more.
A correct rule refuses the second add, because 3 plus 3 is 6. A rule that only reads the quantity box lets it through.
Run these checks before the limit reaches real customers:
- Max plus one: Force a quantity above the cap through the product form and confirm the error appears and nothing is added.
- Two steps: Add part of the cap first. Add the rest plus one and confirm the second add is refused.
- Cart edit: Change the quantity in the cart page and confirm the limit holds. Our guide to editing the WooCommerce cart page explains the classic and block versions.
- Two variations: Add two sizes of one product and confirm they share one cap if they should.
- Checkout: Reach checkout with a cart that breaks the rule and confirm the Place Order button is refused.
Plan variable products with care here. A limit can sit on the parent product or on each variation, and the two behave differently in the cart.
Conclusion
You can limit purchase quantity in WooCommerce with a core checkbox, a free plugin or four short blocks of code. Sold individually covers one unit per order. The free plugin from Method 2 covers a range per product once you tick Prevent add to cart.
Code covers the rules no plugin setting reached on our store. Those are one cap across variations and a cap per customer over time.
Start with the lightest method that matches your rule. Run the checks above before customers see it. If you are still building the store, our guide to setting up WooCommerce on WordPress covers the basics.
Frequently Asked Questions (FAQs)
Q1. Does WooCommerce have a built-in maximum quantity setting?
Not for any number above 1. WooCommerce only ships Sold individually, which limits a product to one unit per order. A maximum such as 5 per order needs a plugin, the paid Min/Max Quantities extension or code.
Q2. How do I set a minimum order quantity in WooCommerce?
Install a min max plugin and fill in its minimum field. The free BeRocket plugin adds a Minimum Quantity field to each product’s Inventory tab. With code, set min_value in the woocommerce_quantity_input_args filter and check it again on add to cart.
Q3. How do I limit the total number of items in one order?
Use a cart-wide cap such as the Cart products quantity fields in the free BeRocket plugin. With a maximum of 4, our cart of 3 mugs refused 2 more bags. The paid Min/Max Quantities extension calls it Maximum Order Quantity.
Q4. Do quantity limits work with the Cart and Checkout blocks?
Yes, when the limit reaches the server. Our code limits came through the woocommerce_quantity_input_args filter and the Cart block stopped its selector at the cap. A woocommerce_check_cart_items check then refused any over-limit order at block checkout.
Q5. Can I limit purchase quantity for guests?
You can limit guests per order with the Method 4 checks but not over time. A per-customer cap needs an account to count orders against. Method 5 asks guests to log in for that reason.
Q6. Why does my limit show an error but still add the product to the cart?
Some plugins warn on add to cart and block only at checkout. The free BeRocket plugin did this with its default settings on our store. Ticking Prevent add to cart in its settings made it refuse the add instead.
Q7. How do I remove a quantity limit?
Reverse the method you used. Untick Sold individually, or clear the plugin’s minimum and maximum fields and save. For code, delete the snippet from your child theme or snippets plugin and clear any page cache.
