This example combines all variants of the same product and limits the total to 5 per order. Use it when you want to count variants with different colors or sizes together.
Prerequisite: The initial setup for Quantity limits must be complete. If you haven't done this yet, see "Initial Setup (Product Quantity Limits)".
You can check the behavior after setup in [Demo] Quantity Limit of 5 for the Entire Product.
When the quantity rule is enabled, it evaluates the total quantity of the eligible variants of the same product in the cart. Quantities are not combined across different products.
Total quantity of the same product is 5 or less: purchase is allowed.
Total quantity of the same product is 6 or more: purchase is not allowed.
Here is an example of adding one product with S, M, and L variants to the cart.
Cart contents | Total | Result |
|---|---|---|
S size × 5 | 5 | Allowed |
S size × 3 + M size × 2 | 5 | Allowed |
S size × 2 + M size × 2 + L size × 2 | 6 | Not allowed |
S size × 3 + M size × 3 | 6 | Not allowed |
(1) Add a quantity rule
Open the app admin → "Quantity limits" → "Quantity rules" → "Add quantity rule".
(2) Enter the settings
Configure the following.
Field | Value |
|---|---|
Title | Any internal title |
Minimum quantity | 1 |
Maximum quantity | 5 |
Increment | Not set |
Applicability | Product |
Eligible items | Products to restrict |
Product message | Enter if needed |
Display timing | Cart updated and checkout |
Message for maximum order quantity | Enter if needed |
(3) Save and enable the quantity rule
After saving the settings, select "Enable." Saving alone does not apply the quantity limit.
(4) Check the behavior
Add the eligible items to the cart in the quantities above, and check the result when the cart is updated and at checkout.
Setting Applicability to "Product" combines the quantities of different variants of the same product. To limit each variant individually, set Applicability to "Variant."
You can use
{{maxQuantity}}in the message for maximum order quantity.