Create a developers app with correct permissions in Shopify admin.
Use Admin API in front end code.
For gift cards list all gift cards, find the code customer put in. If it exists use it. If I understand there is a limit of 250 gift cards. What will happened if there is 251? It will paginate or just ignore the last gift card? Is there an better way to check if the discount is valid?
Check if the code was discount code. How can I check if the discount code is valid?
Apply to cart endpoint. This only solves discount application. How can I apply the gift card?
Is this a good approach or line of thinking in general?
Hi Liam, thank you for answering.
The simple answer, my client wants it.
The longer answer is the following.
Mostly UX design, conversion, and in general easier communication with customers.
In the cart, I want to see my real price as close as possible. So applying discount and gift card codes after the customer proceeds to checkout is a little counterintuitive.
Because some discounts are dependant on the info entered at checkout (eg: free shipping discounts, specific customer segments, combinations, etc) it’s not super reliable to apply Shopify’s native discounting prior to checkout. However you could build a custom solution that could achieve what you’re looking to achieve.
yes you are right I didn’t think about this use case. Anyhow the discount code actually works, but the problem is with the gift cards. It shouldn’t have issues working prior the checkout.
Do you have any advice on the gift cards.