Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hello,
I created an orders create webhook to check if an orders has an specific discount code applied.
I can get that with webhook, but to check this I need the discount code title, which is not coming in the webhook.
Can I get the discount code title in other way?
Solved! Go to the solution
This is an accepted solution.
Hi @diegoalves,
The discount code sent in the webhook does indeed contain the discount codes applied:
"discount_applications": [{
...
}],
"discount_codes": [{
"code": "SUMMERSALE10OFF",
"amount": "9.70",
"type": "percentage"
}],
"note_attributes": [...],
You can GET /admin/api/2020-07/price_rules.json which will contain the "title" key? And may also need to GET /admin/api/2020-07/price_rules/{price_rule_id}/discount_codes.json for the codes under that price rule, if the "title" of the PriceRule is different from the "code" of the DiscountCode.
CalD | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Yes you can GET discounts.json to see if that discount code has been used.
This is an accepted solution.
Hi @diegoalves,
The discount code sent in the webhook does indeed contain the discount codes applied:
"discount_applications": [{
...
}],
"discount_codes": [{
"code": "SUMMERSALE10OFF",
"amount": "9.70",
"type": "percentage"
}],
"note_attributes": [...],
You can GET /admin/api/2020-07/price_rules.json which will contain the "title" key? And may also need to GET /admin/api/2020-07/price_rules/{price_rule_id}/discount_codes.json for the codes under that price rule, if the "title" of the PriceRule is different from the "code" of the DiscountCode.
CalD | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog