API Created Discount Code Not Working (Summarised)

Solved
Etienne_Steyn
Shopify Partner
6 1 0

Hi Team

I need help/ suggestions with the issue below,

After creating a discount code via the admin API before the user checks out, a user is redirected to checkout using a URL with following format https://example.myshopify.com/checkout?discount={GeneratedDiscountCode}

When the user reaches the checkout page the discount code's validity status is just randomly deemed invalid, at other times it works perfectly (It's really intermittent). I rarely manage to replicate the issue after several attempts, when it does happen all I do is click apply and the discount that was deemed invalid is applied normally there after, but a user wouldn't know to do that.

Is there anything I can do to ensure that the discount code is available and ready for use by the time the user reaches the checkout page, besides of course forcing the user to manually insert the discount code?

0 Likes
achieveapplabs
Shopify Partner
497 39 78

Hi @Etienne_Steyn ,

This line here seems odd

After creating a discount code via the admin API before the user checks out

Are you creating a discount code on each request to checkout or something similar? It sounds like you're POSTing to create a discount for each checkout. Do we have that wrong? There's a discount code lookup end point which determines the validity and shouldn't be random. 

Best,

Achieve Team

Use Approovly to create and track order approvals | Looking for more Shopify apps? achieveapplabs.com/#apps
0 Likes
Etienne_Steyn
Shopify Partner
6 1 0

This is an accepted solution.

The issue I described is similar, if not the exact same issue described here, one of the solutions suggested on the thread seems to be working fine for me. As suggested on the thread, all I do when creating a discount code is set the start time to a minute or two behind the current time instead of setting the start time to now. I hope this helps someone. 

0 Likes