Discount code rules
A Code rules discount decides which discount codes buyers can use, such as one code per order, or no codes when the cart has items on sale. When its conditions pass, checkout refuses a matching code and shows your message under the discount code field. Code rules give no discount of their own.
Plan: Deals & Rules or Buddy. Works on all Shopify plans. It appears on the Discounts page in Shopify admin as an automatic discount, titled with its Title.
Each Code rules discount is one rule. For another rule, create another Code rules discount.
Create a Code rules discount
Section titled “Create a Code rules discount”-
In Checkout Buddy, open Customizations. On the Checkout rules tab, click Create customization.
-
Click the Discount code rules card. It opens as the most asked rule, No codes on sale items. For another rule, start from one of the templates instead: they’re listed under the cards, and under Templates → Rules and limits.
-
Under Codes it refuses, choose the codes and write the Message. Then set when it refuses them in the Conditions card.
-
Click Save in the bar at the top of the page. It’s live straight away.
Code rules are always automatic: they check the codes buyers enter.
Templates
Section titled “Templates”| Template | What it does |
|---|---|
| No codes on sale items | Refuses every code when the cart has an item with a compare-at price above its price. Buyers see “Discount codes can’t be used with sale items.” |
| No codes with some products | Refuses every code when the cart has products you pick, such as new launches or limited editions. Collections or product tags work too. |
| STAFF- codes for staff only | Refuses codes starting with STAFF- unless the customer is tagged staff. |
| No codes for wholesale customers | Refuses every code for customers tagged wholesale or buying for a company (B2B). It’s under Templates → Wholesale. |
| One discount code per order | Refuses every code after the first, so buyers can’t stack codes that combine. |
| WELCOME codes on a first order only | Refuses codes starting with WELCOME when the customer has ordered before. A new email counts as a first order. |
| Codes in some countries only | Refuses the codes you list, such as an influencer’s, when the buyer shops from a country you didn’t pick. Add the codes and countries. |
Change a template’s products, tags, codes or countries to yours before you save.
Two more rules you can make yourself:
- Codes that always work: no codes on sale items, except
VIP10, with Codes it refuses set to All codes except these. - No codes on small orders: the condition Cart subtotal is less than
50refuses codes under $50.
Settings
Section titled “Settings”- Codes it refuses: All codes, These codes (a list, such as
SAVE10, WELCOME15), Codes starting with (such asSTAFF-), All codes except these (the Codes that always work, such asVIP10) or Every code after the first (one code per order). Capitals don’t matter. - Message: shown under the discount code field when it refuses a code. Left empty, buyers see “This discount code can’t be used with this order.”
- Conditions: Apply to all checkouts, or Apply only when conditions pass, with cart conditions such as Cart subtotal, Cart products and Line item product tags, plus Customer tags, User is a customer, B2B buyers, Cart has items on sale, Customer’s order count and Buyer’s country. See conditions for functions.
With Apply only when conditions pass, add at least one condition: saving asks for one.
A code is refused when it’s one of the codes and the conditions pass. For example, Codes starting with STAFF- with the condition Customer tags does not include staff refuses staff codes for everyone but staff.
One code per order
Section titled “One code per order”With Every code after the first, the first code stays. Each code after it is refused, with your message. To use another code, the buyer removes the first one. With conditions, the limit applies only when they pass, such as one code per order when the cart has items on sale.
First orders and countries
Section titled “First orders and countries”- Customer’s order count is the number of orders the customer has placed in your store. Shopify knows the customer once they log in or enter their email. A new email has no orders, so it counts as a first order. Customer’s order count is more than
0refuses a code for customers who have ordered before. - Buyer’s country is the country the buyer shops in: their market’s country, then the country of their shipping address once they enter one. Pick one or more countries, then choose is one of or is not one of. Buyer’s country is not one of United States refuses a code outside the United States. If the buyer changes their shipping country later, Shopify takes the code off and shows your message.
What Shopify allows
Section titled “What Shopify allows”- A whole code. It refuses the whole code. It can’t keep the code and leave out just the sale items.
- Other discounts. It can’t check whether another discount applies.
- Links and the cart page. A code from a discount link (
?discount=) or added on the cart page is taken off without your message. Buyers see your message when they type the code at checkout. - Automatic discounts. Each Code rules discount counts toward Shopify’s limit of 25 automatic discounts.
- Codes already applied. If a code breaks a rule later, for example when a sale item is added or the buyer changes their email, Shopify takes the code off and shows your message.
- Two that refuse the same code. The code is refused, and Shopify shows one of their messages.
Things to know
Section titled “Things to know”- No discount, no conflicts. Code rules combine with every discount and take no money off.
- Turning it off. Turn off Enabled under Status and save, or set an end date, and its codes work again.
- Customer conditions. Shopify knows the customer once they log in or enter their email. A guest’s code can show as applied until then.
- Saved before November 7, 2026. A Code rules discount from before then can hold several rules. They apply in order: the first that matches a code refuses it. Each shows as Rule 1, Rule 2 and so on, with arrows to reorder and Remove. They keep working as they are.
- If a code isn’t being refused, check its codes and conditions, and that it’s enabled. See function not working.
