Disallow Discount Codes
Reject discount codes only when certain conditions match, for example for returning customers with small orders. A Playwright Checkout Rules template for cart, pricing and discount codes.
What it does
When a customer enters a code and the rule’s conditions match, Playwright rejects the code and shows your message.
To stop codes stacking with a Playwright offer, you can also use the Exclude Discount Codes cart condition inside a discount rule. See Stop discount stacking.
For example:
- No discount codes for returning customers spending less than $30
Settings
Find it under Line Item Rules in Playwright, in Discount Codes and Reject Discounts and 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 rule to apply, or any one of them. Conditions left at “All” aren’t counted. See All or any.
- Reject code if all qualify
- Reject code if any qualify
- 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.
- Any or all line items
- Whether the item condition below must match any item in the cart or every item.
- Eligible Line Items in Cart
- An optional condition on the items in the cart, checked with the setting above. See product conditions.
- Message
- The message customers see when Playwright rejects their code. Leave it empty to use a default message.
Example: No codes on small repeat orders
- All or any criteria: Reject code if all qualify.
- Eligible Customers: Customer Order Count, Greater than, 0.
- Eligible Carts in Checkout: Cart/Item/Discount subtotal, Cart current subtotal, Less than, 30.
- Message: “Codes work on orders over $30.”
At checkout: A returning customer with a $25 cart can’t use a code. A first order, or a $40 cart, can.
On Shopify Functions
Playwright publishes this template as part of the Shopify discount “Playwright: discount rules”, and as “Playwright: discount codes” when its rules check for codes.
- Codes are only rejected when Shopify allows it, and codes your own rules check for are never rejected. See Rejecting codes.
These conditions aren’t available in discount rules, 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.
- 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.
Tag conditions match whole tags only. See Conditions and Publishing.