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 ?
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-parameter-to/td-p/2136102
https://community.shopify.com/c/online-store-and-theme/automatic-discount-application-for-direct-checkout/m-p/2153962
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.
2 Likes
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`);
1 Like