All things Shopify and commerce
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
@DonShopifyGuru @ShopifyGuru1 @Trevor
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.
Facing the same issue.
We have been experiencing the same issue for the last few days.
We are having the same issue.
This happened last year :
https://community.shopify.com/c/shopify-discussions/valid-discount-code-passed-as-a-query-parameter-...
Hey, it's Tobe from Regios Automatic Discounts.
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.
Hello Tobe!
The situation here,
regarding the address that the discount code was sent to the checkout page.
Ex:
/checkout?discount=XXXXX
This discount code parameter does not always apply the code.
Shopify removed this feature due to privacy reasons. Instead use the following workaround:
https://store.myshopify.com/discount/DISCOUNT_CODE?redirect=/checkout
//my example
let baseUrl = window.location.protocol + "//" + window.location.hostname;
checkout.attr('href', `${baseUrl}/discount/${discountCode}?redirect=/checkout`);
Yes, thank you for your answer
But how to apply 2 discount code your example url? Any idea would be great for us.
As far as I am aware, it is not possible using the /discount/${discountCode} format to add multiple discount codes.
You need to use the format like this:
http://{shop}.myshopify.com/cart/123456789:1,012345678:1?discount={discount_code},{discount_code2}
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.
https://shopify.dev/docs/apps/build/checkout/create-cart-permalinks#step-4-optional-apply-discounts
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.
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:
/cart?discount=[discount code]
We are facing the same issue 😕