What is the equivelant of currentCartDiscountAmountSet in Orders/updated webhook?

asoola
Tourist
14 0 1

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? 

0 Likes
james-langille
Shopify Staff
Shopify Staff
57 12 15

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.

james-langille | Developer @ 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

0 Likes