Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
HI,
In my code, I am listening to the orders/updated webhook. According to your docs (https://shopify.dev/docs/admin-api/graphql/reference/orders/order), an order has the field currentCartDiscountAmountSet. This is the "amount of order-level discount minus the amounts for linte items that have been returned. This doesn't include line item discounts". I noticed that this field is missing from the orders/updated webhook. How do I derive this information from the webhook directly? Right now, when I receive the webhook, I'm forced to make a graphql call to retrieve currentCartDiscountAmountSet.
I noticed that the webhook has a discount_allocations field.
discount_allocations: [
{
amount: '272.99',
discount_application_index: 1,
amount_set: {
shop_money: {
amount: '272.99',
currency_code: 'CAD',
},
presentment_money: {
amount: '272.99',
currency_code: 'CAD',
},
},
},
],
I noticed that the amount here correlates with currentCartDiscountAmountSet, when discount_application_index = 1. But I can't find this documented anywhere in the docs. Can you advise?
Hello @asoola, the fields that are exposed in the webhooks come from the REST api, not the GraphQL api, so unfortunately, this field isn't currently exposed in the webhook and querying the APIs is probably the best workaround for you at the moment.
To learn more visit the Shopify Help Center or the Community Blog.