Quantity Limit
Stop checkout above a set quantity of a product or variant, with a message that explains the limit. A Playwright Checkout Rules template for cart, pricing and discount codes.
What it does
When the rule’s conditions match, Playwright checks the selected items against the limit. A customer over the limit sees “You can buy at most 2 of Classic Hat” (or “You can’t buy Classic Hat” when the limit is 0) and can’t check out until they lower the quantity.
The limit applies when the conditions match. For example, with a customer tag condition that matches “Does not” wholesale, everyone except wholesale customers is limited.
For example:
- You may purchase a total of two hats in any style
Settings
Find it under Line Item Rules in Playwright, in Other. Give the rule a name, fill in these settings and select Save Rule.
- All or any criteria
- Whether all of the conditions you set must match for the limit to apply, or any one of them. Conditions left at “All” aren’t counted.
- Eligible Customers
- Which customers the rule applies to: “All”, one customer condition, or a Multi-Select that combines up to three. See customer conditions.
- Eligible Carts in Checkout
- Which carts the rule applies to: “All”, one cart or shipping address condition, or a Multi-Select that combines up to three. See cart conditions and destination conditions.
- Eligible Line Items in Cart
- Which items the limit covers. See product conditions.
- Limit by
- Limit by product caps each matching product, Limit by variant caps each variant of it, and Limit cart caps all the matching items together.
- Maximum amount
- The most a customer can buy. 0 means they can’t buy the selected items at all.
Example: Two hats per order
- Eligible Line Items in Cart: Product Type, Is one of,
Hat. - Limit by: Limit cart. Maximum amount: 2.
At checkout: A customer with 3 hats sees a message at checkout and can continue once they remove one.
On Shopify Functions
Playwright publishes this template as part of the Shopify validation “Playwright: quantity limits”.
- Shopify Functions can’t change quantities. Customers over the limit see a message and can’t check out until they reduce the quantity.
These conditions aren’t available in quantity limits, so a rule that uses one isn’t published:
- Customer Accepts Marketing: Shopify Functions can’t see whether a customer accepts marketing. Tag those customers and use a customer tag condition instead.
- Has Properties: Line item properties aren’t available to Shopify Functions.
- Cart Total Weight: Cart weight isn’t available to Shopify Functions.
- Cart Has Discount Code: Only discount rules and shipping discounts can see which discount code was entered.
- Cart Has No Discount Code: Only discount rules and shipping discounts can see which discount code was entered.
- PO Box Qualifier: Street addresses aren’t available to discount rules. Use this condition in shipping or payment rules.
- Full Address Qualifier: Street addresses aren’t available to discount rules. Use this condition in shipping or payment rules.
- Compare to billing address: Shopify Functions can’t compare billing and shipping addresses here.
- Discounted Cart Subtotal (applied by discount code): Shopify Functions only see the discount code itself, not its type or value.
- Exclude Discount Codes: Only discount rules and shipping discounts can see which discount code was entered.
Tag conditions match whole tags only. See Conditions and Publishing.