How to Set a Category Products Count Condition in WooCommerce

Minimum and Maximum Quantity for WooCommerce lets you limit how many units a customer can buy. The Category Products Count condition applies a group’s min and max quantity only when the cart already holds a set quantity of products from the categories you choose.

You select the categories in the same rule group, then enter the quantity those products must reach. A clothing store can require at least 4 units from the Shirts category before a maximum quantity applies to shirts.

Benefits

Configuring Category Products Count can help:

  • Apply a quantity limit only after customers add enough products from the categories you select.
  • Combine every product in those categories into one cart quantity.
  • Leave products in other categories on their own rules.

How to Set a Category Products Count Condition

Step 1: Open a min/max rule

Go to Dotstore Plugins → Min/Max Quantity.

On Manage Rules, click Add New, or open an existing rule.

Step 2: Add a category condition

In the rule group, under Conditions, set the first condition to Category.

Choose Equal to ( = ) and select the categories this count should include. Choose Not Equal to ( != ) when the count should cover cart products outside the categories you select.

Category Products Count cannot be saved on its own. The same group must include at least one Category condition. If it does not, saving shows: “To use the category products count condition, it must require at least one category-based condition.”

Step 3: Add the Category Products Count condition

Click + Add Rule.

Set the new condition to Category Products Count, under Group Based Conditions.

Choose how the cart quantity should compare with your number:

Option What it does
Equal to ( = )
The counted quantity must match the number.
Not Equal to ( != )
The counted quantity must not match the number.
Less than ( < )
The counted quantity must be below the number.
Less or Equal to ( <= )
The counted quantity must be the number or below.
Greater than ( > )
The counted quantity must be above the number.
Greater or Equal to ( >= )
The counted quantity must be the number or above.

In Type category products count, enter a whole number of 1 or higher. The plugin adds up the cart quantities of products assigned to the selected categories. It does not count each product as 1 regardless of quantity.

If the group has more than one condition, set below to Any or All rule match.

  • Any applies the group when one condition matches.
  • All applies the group only when every condition matches.

Step 4: Set the group quantity limits

In the same group’s Actions, enter Min Quantity and Max Quantity.

These are the limits applied when Category Products Count matches. They are separate from the number in Type category products count.

Step 5: Save and test the cart

Click Save changes.

Add products from the selected categories to the cart and change their quantities. The group’s min and max quantity apply only when the combined quantity matches the comparison you set, and only for a product assigned to a category included by the Category condition in that group.

Example Use Cases

A category minimum before the limit applies. If shirts should reach 4 units together before a maximum of 2 applies, select the Shirts category, set Category Products Count to Greater or Equal to ( >= ) 4, and set Max Quantity to 2.

A mixed-category cart. If the rule should wait until Hoodies and Jackets together reach 8 units, select both categories, set Category Products Count to Greater or Equal to ( >= ) 8, and set the group’s Min Quantity.

Conclusion

Category Products Count checks the combined cart quantity of products in the categories selected in the same rule group. When that quantity matches your comparison, the group’s min and max quantity apply to those products.

FAQs

1. Where do I find Category Products Count?

Open Dotstore Plugins → Min/Max Quantity, edit a rule, and look under Conditions → Group Based Conditions. It is a Premium condition.

2. Why will the rule not save?

The same group needs a Category condition. Category Products Count uses that condition to decide which cart items to add up.

3. Does a child category count toward its parent?

Only when the product is assigned to the category you selected; choosing a parent category does not automatically include products assigned only to a child category.

4. Do variations count?

Yes. A variation uses the categories assigned to its parent product, and its cart quantity is included.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.