Skip to content
GPLWP Guides

How to set minimum and maximum product quantities in WooCommerce

WooCommerce Time About 20 minutes 6 steps Updated 23 Sep 2026

WOOCOMMERCE
The short answer

WooCommerce has no general built-in screen for setting per-product minimum and maximum quantities. You can add limits with custom PHP, but a quantity-rules plugin is safer when limits must also hold in the cart, for variations, and across repeated add-to-cart actions.

The route
  1. 01Define the quantity rule
  2. 02Check the built-in option
  3. 03Add limits with custom PHP
  4. 04Install a quantity-rules plugin
  5. 05Configure product and variation limits
  6. 06Test the complete buying path

What you need

  • A WooCommerce store on WordPress 6.0 or later
  • Administrator access to WordPress
  • A child theme or code-snippets tool if using custom PHP
  • A test product and test customer account

Define the quantity rule

Decide whether the rule applies to one product, a specific variation, a category, or the whole order. A product limit such as 3 to 10 means the customer must buy at least 3 and no more than 10 units of that product in the order.

If customers must buy in packs, define a multiple as well. For example, a minimum of 6, maximum of 24, and group of 6 allows 6, 12, 18, or 24 only. WooCommerce's official Min/Max Quantities documentation treats minimum, maximum, and group quantities as separate rules.

Check the built-in option

For a simple one-per-order rule, edit the product and look for the product editor's purchase restriction that limits a product to one item per order. This is suitable for products that can only be bought once, but it does not replace a general minimum-and-maximum quantity system.

For rules such as minimum 5 and maximum 20, or different limits for each variation, move to custom code or a quantity-rules plugin.

Add limits with custom PHP

For a developer-managed store, WooCommerce documents the woocommerce_quantity_input_args filter for setting the quantity field's min_value, max_value, and step. Variable products need separate handling through woocommerce_available_variation, using min_qty and max_qty. Put the code in a child theme or a code-snippets tool, not the parent theme's functions.php.

Do not treat the input attributes as the whole rule. They mainly control what the customer sees and selects. To stop bypasses and enforce limits when quantities are added or changed in the cart, the custom solution also needs server-side validation using WooCommerce's add-to-cart and cart-update validation points. WooCommerce exposes woocommerce_add_to_cart_validation and woocommerce_update_cart_validation for those operations.

Install a quantity-rules plugin

For a store without a developer, install a plugin that supports minimum and maximum quantities per product and variation. After activation, open its settings, enable the quantity rules, then edit a product and enter the minimum, maximum, and optional quantity step.

WPC Product Quantity for WooCommerce is a suitable shortcut when you need per-product or per-variation limits, decimal quantities, and different quantity input styles. Check that its rules apply to the cart as well as the product page before using it on a live shop.

Configure product and variation limits

Open a product and set the rule for the product itself. For a variable product, check each variation separately if customers can order different quantities for different options. Add a clear message such as Buy at least 3 and no more than 12, and explain pack sizes where a step is used.

Be careful with repeated add-to-cart actions. A customer can add 4 units, return to the product page, and add 4 more. The rule must check the combined cart quantity, not only the quantity in the latest request.

Test the complete buying path

Test a quantity below the minimum, exactly at the minimum, between the limits, exactly at the maximum, and above the maximum. Then add the same product twice and change its quantity on the cart page.

Test simple products, every relevant variation, decimal quantities if enabled, and both the classic cart and Cart Block if your site uses them. Check that the error appears before checkout and that a customer cannot bypass the rule by editing the cart or using a direct add-to-cart request. WooCommerce's Store API includes quantity-limit validation for cart items, but third-party code must still be compatible with the shopping experience your site uses.

The fast route

Let WPC Product Quantity for WooCommerce do it

Per-product and variation quantity limits with decimal support and selectable input styles for controlled ordering.

Get WPC Product Quantity for WooCommerce

Sources

  1. woocommerce.com /document/minmax-quantities/?utm_source=openai
  2. woocommerce.com /document/new-product-editor-beta/?utm_source=openai
  3. woocommerce.com /document/adjust-the-quantity-input-values/?utm_source=opena…
  4. woocommerce.github.io /code-reference/files/woocommerce-includes-class-wc-form-han…
  5. woocommerce.github.io /code-reference/classes/Automattic-WooCommerce-StoreApi-Util…

Questions

Does WooCommerce have minimum and maximum product quantities built in?
No, WooCommerce does not provide a general product-level minimum-and-maximum quantity screen in core. It can support a one-item-per-order restriction for suitable products, while broader rules need custom PHP or a quantity-rules extension. The official Min/Max Quantities extension adds product, category, and order quantity rules through the product editor and WooCommerce settings.
Can I set different limits for each variation?
Yes, but the method must handle variations explicitly. WooCommerce's documented quantity-input approach uses variation data separately from simple products, and quantity-rules extensions can provide variation-level settings. Test every variation because a limit shown on the parent product may not automatically enforce the same limit after a customer selects an option.
Will changing the minimum and maximum input values enforce the rule?
Not by itself. Setting the input's minimum and maximum values controls the product-page field, but customers can submit requests outside those values or change quantities in the cart unless server-side validation also runs. A complete custom solution should validate both add-to-cart requests and cart quantity updates, or use a plugin that already does so.
Why can customers exceed the maximum by adding the product twice?
Customers can exceed a maximum when a rule checks only the latest add-to-cart quantity instead of the product's combined quantity in the cart. For example, two separate additions of 6 can bypass a maximum of 10 if each request is checked in isolation. Test repeated additions and cart edits, and use a solution that validates the resulting total quantity.
What is the fastest way to set product quantity limits?
Install a quantity-rules plugin, configure its minimum and maximum fields, apply the rule to the product or variation, and test the cart. WPC Product Quantity for WooCommerce is a practical choice when you need per-product and variation limits, decimal support, and selectable input styles without maintaining custom PHP.