Apply Discount by Code
Give a different discount for each discount code: one list of codes, each with its own discount type and amount. A Playwright Checkout Rules template for cart, pricing and discount codes.
What it does
When a customer enters one of the codes on the list and the rule’s conditions match, Playwright discounts the selected items by that code’s amount. Codes are matched without regard to capital letters, and the code is shown as the discount’s message.
Playwright creates each code on the list in Shopify when you publish, so you don’t create them yourself. See Discount code rules.
For example:
- '10OFF' and 'HALFOFF' codes provide discount of $10 and 50% for first time customers who accept marketing
Settings
Find it under Line Item Rules in Playwright, in Discount Codes. 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.
- Discount if ALL of the following criteria are met
- Discount if ANY of the following criteria are met
- 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 in the cart get the discount: “All” items, one product condition, or a Multi-Select. See product conditions.
- Discounts
- One row per code: the code, the discount type (Fixed total discount split across the selected items, Percent discount, Fixed per item discount, or Use the discount code type) and the amount. Each code can appear only once.
Example: Two codes, two offers
- Discounts:
10OFF: Fixed total discount : 10, andHALFOFF: Percent discount : 50. - Eligible Customers: Customer Order Count, Less than, 1.
At checkout: A first-time customer who enters 10OFF gets $10 off the order’s items; HALFOFF gives them 50% off. Returning customers get nothing from either code.
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.
- Shopify Functions see only a code’s text, not the type or value it has in Shopify. A row set to Use the discount code type is treated as a fixed total discount of the amount you enter in that row.
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.