API Created Discount Code Not Working

Etienne_Steyn
Shopify Partner
6 1 0

Hi Shopify Team, 

 

I'm not the most experienced person when it comes to Shopify applications but what I'm doing is really simple: 

A created a discount code using the shopify api based on a value a user selects on a range slider input, that discount code can only be used by that single user, I then redirect the user to checkout with the discount code in the URL as query string.

everything works fine the discount code is created and I have verified this by checking on the admin portal and now I've even resorted to checking(programmatically) and logging whether the discount code was found by Shopify API before redirecting to checkout, so far there hasn't been once that it hasn't been found.

The problem

I redirect the user to the checkout page after creating a discount code via the discount API using a URL that's similar to the following https://example.myshopify.com/checkout?discount={GeneratedDiscountCode}

When the user reaches the checkout page the discount codes validity status is just randomly deemed invalid at other times it works perfectly (It's really intermittent). I managed to randomly 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.

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