Short description of issue
A customer-segment discount code shows as applied in guest carts. Checkout removes it only after the buyer enters an email.
Reproduction steps
Reproduced 2026-10-11 14:59 UTC.
- Open a new browser session. Do not log in.
- Send
POST /cart/add.jswith one full-price item from the code’s collection. - Send
POST /cart/update.jswith{"discount": "MEMBER40"}. The response (trimmed):
"discount_codes": [{ "code": "MEMBER40", "applicable": true }],
"original_total_price": 6500,
"total_discount": 2600,
"total_price": 3900
- Go to checkout. The code stays applied until you enter an email. For an email outside the segment, checkout shows “MEMBER40 discount code isn’t available to you right now”.
Setup: a native code discount (DiscountCodeBasic). Its context is DiscountCustomerSegments with one segment (customer_tags CONTAINS '<tag>') and no other limits.
Additional info
Why this is a problem
Checkout blocks the order, so we lose nothing online. Two costs remain:
- Brand value. Restricted codes leak to coupon sites and group chats. Anyone with a leaked code sees the member price and the full saving in the cart. That alone devalues the code and the brand, even when the order never goes through.
- Physical retail. Buyers show the cart to our store staff and say the code works online, so the checkout failure must be a glitch. Staff then argue with a customer who holds a screenshot. Every merchant that also sells through Shopify POS has this problem.
A restricted code should not look applied before Shopify knows who the buyer is. “Not eligible until the buyer is identified” is the safer default.
Questions
- Is this behaviour intended? I could not find it in the Ajax API or discount docs.
- Can a storefront tell that eligibility still waits on buyer identity? A flag on
discount_codesis enough. - Is a setting planned to keep a segment code not applicable until the buyer is identified?
Both of our workarounds copy the segment rule into a second place. One checks customer.tags in the theme against a list of gated codes. The other rebuilds each segment code as an app discount, with a Discount Function that checks buyerIdentity.customer.
I can DM the shop domain. Thanks.
What type of topic is this
Feature request