Automatic discount codes passed via URL (e.g., /checkout?discount=CODE) intermittently fail to apply at checkout. Multiple merchants report the code appears in the query string but isn’t reflected in the checkout discount box.
Recent developments:
One participant claims Shopify removed direct discount application via query params for privacy, suggesting a workaround: /discount/DISCOUNT_CODE?redirect=/checkout (often implemented via JS). Shortly after, they noted Shopify reverted changes and the old method worked again, but others still report failures. Behavior remains inconsistent.
Applying two discount codes via the /discount path isn’t supported. A documented alternative is a cart permalink including variant IDs and comma-separated codes: /cart/{variantId:qty,…}?discount=code1,code2. Caveats: requires at least one variant ID, overwrites the existing cart and discounts, and must include all current items/discounts.
Context and references: prior similar issue reported last year; links and code snippets are central to the discussion.
Status: unresolved and ongoing. Key open questions: whether Shopify has permanently changed discount application behavior and what the reliable, supported method is for single/multiple codes.
Summarized with AI on December 15.
AI used: gpt-5.
Again and again, the same issue is happening, the automatic discount code is not getting applied from the cart to the checkout for several merchants, and when our tech team analyzed the cause for this.
Keep note - Sometimes is working or sometimes not working, Discount code is available in the query parameter but is not applied automatically in a discount box on the checkout page.
Is there a specific reason you’re using discount codes instead of automatic discounts, if you want discounts automatically applied to the user’s cart?
I’m not 100% sure I understand your use case, but it’s possible that with some more details, I could identify the cause. I’ve done some work using discounts in Shopify recently, so maybe something I learned could be useful, even if it doesn’t directly solve your problem.
I have tried this, but it gets stuck and doesn’t redirect to the checkout for some reason. I added the url to the form action and it just goes to the page and never redirects.
Yeah, that’s because Shopify just reverted their code a few days ago. I don’t know what’s going on with their development team, but now the old method works again.
Weird, I reverted back to the old method and it’s not working either. Shows the discount code in the url, but not on the checkout page. Any insight would be greatly appreciated. This is what I have on the post action:
where the example numbers 123456789 and 012345678 are variant IDs.
I found that this link format requires having at least 1 variant ID in it for it to work.
Unfortunately, if you only have the discount code in the link, it seems to have no effect.
Also unfortunately if you are just trying to add a discount code, the link format will overwrite any products in the cart and discounts that are already applied, so you need to ensure the link includes all products that are already in the cart and all discounts that have already been applied, as well as the new discount.