App reviews, troubleshooting, and recommendations
Discount Code application from an app is...to put it mildly, problematic.
As far as I can tell, there are two ways that definitely work for a public app to add a DiscountCode to a purchase, without requiring the user to manually enter the code at checkout:
1. Query string application / URL redirection
2. The Storefront API (https://shopify.dev/api/storefront/2022-01/mutations/checkoutDiscountCodeApply)
As well as possibly editing an Order from the Admin API, except that requires taking over the Order creation process from the store. Not ideal!
Now, the Storefront API is locked behind converting your app to a sales channel -- a very significant functionality change, and a process that isn't even viable for public apps that already have installed users--meaning literally the only viable method appears to be query string redirects.
This seems like EXTREMELY basic functionality that should be part of the AJAX Cart API: https://shopify.dev/api/ajax/reference/cart; it's a very negative user experience to force them through a page redirect / refresh JUST to apply a Discount Code, and a negative (and brittle) merchant experience to inject theme code modifications to adjust the query string for checkout URL(s).
Solved! Go to the solution
This is an accepted solution.
fetch(`/discount/${DiscountCode}`)
This is the answer, shoutout to Landon Fuhr#2944 for pointing it out. No idea why this isn't documented anywhere!
This is an accepted solution.
fetch(`/discount/${DiscountCode}`)
This is the answer, shoutout to Landon Fuhr#2944 for pointing it out. No idea why this isn't documented anywhere!
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025