Short version: Shopify discount codes are created in your admin. Go to Discounts → Create discount, choose the type, keep the method on Discount code, set the value and what it applies to, then check four settings before saving: minimum requirements, eligibility, maximum uses and combinations. Then test it in a private browser window as a guest, on desktop and on your phone.
How to create a discount code in Shopify
- In your Shopify admin, open Discounts and click Create discount.
- Pick the type. For a sale code you'll usually want Amount off products (only some products) or Amount off order (the whole cart). The other types are Buy X get Y and Free shipping.
- Leave the method on Discount code and type the code, or use Generate random code. Customers have to type it at checkout unless you share a discount link.
- Set the value: a percentage or a fixed amount.
- For product discounts, choose what it applies to: specific collections or specific products.
- Work through the settings below, then click Save.
The settings that decide whether the code works
These are the fields on the Create discount screen. Each one is a common reason a code fails for some shoppers and not others.
| Setting | Options | What goes wrong |
|---|---|---|
| Applies to | Specific collections or specific products | A promoted product isn't in the collection, or only one variant was picked. The shopper sees "isn't valid for the items in your cart". |
| Eligibility | All customers, markets, customer segments or specific customers | A segment code fails for first-time buyers, and can disappear for a guest once they enter their email. A market-limited code fails for shoppers in another market. Options vary by discount type. |
| Minimum purchase requirements | None, minimum amount, or minimum quantity | "20% off" with a $50 minimum fails on a $30 cart, and shoppers read it as broken. |
| Maximum discount uses | Limit total uses and/or one use per customer | A capped code stops working mid-sale. A one-per-customer code fails for returning customers. |
| Combinations | Which other product, order or shipping discounts it can combine with | By default a new discount won't combine with others. If an automatic discount is running, the code may be rejected or lose to the better offer. |
| Active dates | Start date and time, optional end date | Times follow your admin's time zone, not the shopper's. The sale can start or end hours off. |
The troubleshooting guide covers each failure in more detail, and the error message pages explain exactly what each checkout message means.
Discount code or automatic discount?
An automatic discount applies itself when the cart qualifies. A code only applies when the shopper types it, or arrives through a discount link. Codes are better when you want to track a channel (an email, an influencer, a single ad). Automatic discounts are better when you don't want shoppers to miss out.
Running both at once is the setup most likely to give a result you didn't expect. If they're not set to combine, Shopify gives the shopper the better-value one and the other is dropped. We explain the rules in Shopify discount combinations.
Sharing the code
You can send the code itself, or a discount link that adds it for the shopper. A link means nobody has to type the code, so a typo can't cause "Enter a valid discount code". Keep codes to letters and numbers: Shopify warns that special characters may not carry through to a checkout link correctly.
How to test a Shopify discount code before you send it
The admin tells you the code exists. It doesn't tell you what a shopper sees. Before the email goes out:
- Open a private browser window, so you aren't logged in to your store.
- Go to a product you're promoting, add it to the cart and go to checkout.
- Enter the code and look at the discount line.
- Work out the number yourself: 20% of a $85.00 item is $17.00. Check it matches to the cent.
- Do the same on your phone.
- Stop before payment. You don't need to place an order.
The full checklist, including what to recheck the day before launch, is in how to test a Shopify discount code before launch.
Let the checkout check run itself
CampaignCart QA does the test above for you: a real guest checkout on desktop and mobile, the expected discount against the one checkout showed, and screenshots. It stops before payment. It currently works with US stores in USD and English, percentage codes and one-time products. There are 3 free checks per store.
See it on the Shopify App Store