Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: Auto apply discount code at checkout doesn't work anymore

Solved

Auto apply discount code at checkout doesn't work anymore

xavier-redcod
Shopify Partner
33 1 2

We have a discount management app applying automatic discounts using discount codes at checkout.

It seems that, for some reason, we're now unable to apply discount code at checkout using the "discount" query param in URL :

 

https://store.myshopify.com/checkout?discount=DISCOUNT_CODE

 

Is it a bug ? Did Shopify just removed this feature ?

Accepted Solution (1)

Starshards
Shopify Partner
45 2 14

This is an accepted solution.

Yes, Shopify removed this feature for privacy reasons. Instead, you can use a workaround:

 

https://store.myshopify.com/discount/DISCOUNT_CODE?redirect=/checkout 



Here is my code for it:

var baseUrl = window.location.protocol + "//" + window.location.hostname;
checkout.attr('href', `${baseUrl}/discount/${discountCode}?redirect=/checkout`);

 

View solution in original post

Replies 2 (2)

tobebuilds
Shopify Partner
593 42 159

It might be a bug. There have been a couple of threads opened lately related to this issue:

 

https://community.shopify.com/c/shopify-discussions/again-valid-discount-code-passed-as-a-query-para...

 

https://community.shopify.com/c/online-store-and-theme/automatic-discount-application-for-direct-che...

 

And probably a few more if you search for "discount," sort by date, and go back through posts over the past 2 weeks or so.

 

Not sure what the cause is, but I'm pretty sure you're not the only one.

Founder, Regios Discounts app (4.8 stars, 93 reviews, Built for Shopify)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
- Often imitated, never duplicated

Starshards
Shopify Partner
45 2 14

This is an accepted solution.

Yes, Shopify removed this feature for privacy reasons. Instead, you can use a workaround:

 

https://store.myshopify.com/discount/DISCOUNT_CODE?redirect=/checkout 



Here is my code for it:

var baseUrl = window.location.protocol + "//" + window.location.hostname;
checkout.attr('href', `${baseUrl}/discount/${discountCode}?redirect=/checkout`);