All articles
2026-08-12 · Dreamfox Team

Minimum Quantity by Category in WooCommerce

Set a minimum quantity by category in WooCommerce: category-level rules, how they combine with product rules, mixed carts and validation that cannot be bypassed.

Product category folders with rule tags beside a shopping cart for WooCommerce minimum quantity by category

Editing minimum quantities on four hundred products is not a plan. When a whole range shares a packing format — tiles by the square metre, drinks by the tray, fasteners by the bag — the rule belongs on the category, and every product inherits it.

Category total or per product?

This choice decides everything downstream. A minimum of six on the "Ceramic tiles" category can mean:

  • Category total: any mix of tiles adding up to six. Friendly, and usually what the warehouse actually needs.
  • Per product: six of each tile in the cart. Much stricter, and only correct when each SKU is packed separately.

Pick one, write it down, and make the checkout message match. A customer who is told "minimum 6" and then blocked at 6 mixed items will not guess that you meant six of each.

Summing a category across the cart

The category-total model needs a pass over the cart, grouping by term:

```php add_action( 'woocommerce_check_cart_items', function () { $totals = []; foreach ( WC()->cart->get_cart() as $item ) { foreach ( wc_get_product_term_ids( $item['product_id'], 'product_cat' ) as $term_id ) { $totals[ $term_id ] = ( $totals[ $term_id ] ?? 0 ) + $item['quantity']; } } foreach ( $totals as $term_id => $qty ) { $min = (int) get_term_meta( $term_id, 'min_qty', true ); if ( $min && $qty < $min ) { $term = get_term( $term_id ); wc_add_notice( sprintf( 'Minimum %d items from %s.', $min, $term->name ), 'error' ); } } } ); ```

Two details save support time later: name the category in the message, and state how many more items are needed rather than only the threshold.

Precedence when rules overlap

Products belong to several categories, and categories nest. Settle the order once:

  1. A product-level rule, if set, wins outright.
  2. Otherwise the strictest matching category rule applies.
  3. A child category overrides its parent when both carry a value.

Whatever you choose, expose it in the admin so a shop manager can see which rule an item inherited. Invisible inheritance is how stores end up with a cart nobody can check out of and nobody can explain.

Mixed carts need a single verdict

A basket containing tiles, adhesive and one uncategorised tool should evaluate each category rule independently and block only on the ones that fail. Blocking the whole cart with a generic "quantity requirements not met" turns a two-second fix into an abandoned order.

Doing it as configuration

Min & Max Quantities for WooCommerce supports category-level minimums, maximums and step increments with product-level overrides, evaluates them across the whole cart, and reports which rule failed. Multivendor stores that need the same logic per seller can use the multivendor add-on, which keeps each vendor's totals separate instead of pooling the basket.

For the underlying mechanics, see how to set a minimum order quantity; for B2B-specific limits, see quantity limits by user role.

Review the rules once a season

Categories drift. New products arrive, packing formats change, and a rule set in January quietly blocks a range added in June. A quarterly look at which categories carry rules — and a test order in each — keeps the model honest.

FAQ

How do I set a minimum quantity per category in WooCommerce?
Attach the rule to the product category term rather than to individual products, then sum the quantities of all cart items in that category and validate the total before checkout.
Does a category minimum apply per product or to the category total?
Both models exist. A category total is usually what wholesale stores want: six items from the range, in any mix. A per-product reading forces six of each item, which is far stricter.
What happens when a product sits in two categories with different minimums?
Apply the strictest rule that matches, and say which category triggered it in the notice. Ambiguous messages are the main reason customers abandon a blocked cart.
How do category rules interact with product-level rules?
Product rules should win when both exist, since they are the more specific setting. Keep the fallback order documented so shop managers can predict the result.
Can I exclude a product from its category rule?
Yes, and you usually need to. Sample packs, spare parts and clearance lines are the common exceptions, so allow an override flag on the product itself.

This article is part of our WooCommerce quantity rules topic hub, where the related plugins and guides live together.

Keep reading