Discussing APIs and development related to customers, discounts, and order management.
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
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 ?
Solved! Go to the solution
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`);
It might be a bug. There have been a couple of threads opened lately related to this issue:
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.
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`);