This example limits the same variant to 1 per order. Use it for limited-quantity items or lottery-sale items.
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 1 or Less.
When the quantity rule is enabled, it evaluates the total quantity of the same variant in the cart.
Total quantity of the same variant is 1: purchase is allowed.
Total quantity of the same variant is 2 or more: purchase is 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 | 1 |
Increment | Not set |
Applicability | Variant |
Eligible items | Products or variants 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 target variant to the cart in the quantities above, and check the result when the cart is updated and at checkout.
Different variants are evaluated separately, so you can purchase 1 of each. To limit the total across all variants of a product to 1, set Applicability to "Product."