Shopify coupon code restriction in regular checkout and use in draftorder checkout url

Topic summary

Goal: Make a coupon apply only on a draft order checkout URL (a checkout generated from a Draft Order link) and not on the regular store checkout, even with identical products. Current approach using discountCodeBasicCreate cannot restrict usage to only draft checkouts.

Suggested approach: Add a hidden marker (e.g., line item attribute or cart attribute) when creating the draft order/checkout. Then implement a Shopify Discount Function that validates this attribute and applies the discount only when present, blocking it on regular checkouts. A prototype can be tested with a discount app (e.g., Dollarlabs: Ultimate Discounts) before building the logic natively via Shopify Functions.

Key terms: Line/cart attributes are custom properties you control; Discount Functions are server-side rules for conditional discounts in Shopify.

Status/outcome: The requester will try the suggested method and resources. No confirmed resolution yet; discussion remains open.

Summarized with AI on December 10. AI used: gpt-5.

Hi Team,

I am developing a shopify remix app using typescript, and want to apply coupon code generated for draftorder checkout url and not in regular checkout url even if it has same products as in draft order. Now I am using mutation discountCodeBasicCreate but it does not restrict it to regular checkout. Pls suggest a solution for this. It would be great help if anybody could help?

@1256 , easiest suggestion would be to add some sort of hidden line attribute / cart attribute and then apply a discount to only those checkouts that do have this attribute on them.

I’d suggest checking out discount functions for setting such logic up since you control the draft order creation process, it should be straightforward to do so.

To prototype this and test if this flow would work, try out a discount app like Dollarlabs: Ultimate Discounts and set up the offer there and give it a shot.

And once you can confirm working, feel free to build out the discount functionality in your app to enable the logic you mentioned.

1 Like

Hi @Abel_Lesle

Thank you for your reply. I will check it out.

1 Like