Discussing APIs and development related to customers, discounts, and order management.
We are currently using the Shopify script to validate discount codes entered on the checkout screen, but we are in the process of migrating this to be handled by Shopify functions when the script is discontinued in the future.
However, I cannot find a way to get the discount code entered on the checkout screen in Shopify functions.
If anyone knows how to do this, please let me know.
Along with that, we also need to get the customer's tag in Shopify functions. Please let me know if anyone knows how to do that as well. Thank you in advance.
You might be able to target it using the dev preview discount api. This at least makes it look like you can grab the code - from there you could do something with it.
Have not tried this out yet.
Thank you for your guidance.
But how can I use this API to get the code entered from the checkout screen?
https://shopify.dev/docs/api/functions/reference/order-discounts/graphql/common-objects/discount
I don't see any field in the documentation that would allow me to retrieve the code entered.