New Shopify Certification now available: Liquid Storefronts for Theme Developers

Incorrect discount amount on order items in orders/fulfilled webhook json

Ray14
Shopify Partner
19 0 0

Hi,

 

I have created a manual order.

Ray14_1-1693451222009.png

 

And split fulfilled order into two locations. 

Ray14_2-1693451231950.png

 

This triggered orders/fulfilled webhook and found the discount amount on order item is incorrect.

It showed a correct amount in Shopify admin page, but the discount_allocations property in webhook's json value showed an incorrect value.

If you see screenshots above, $10 discount was given to the order that contained two items. Given that the quantity is only one on a screenshot below, shouldn't the discount amount be 5 instead of 10?

I was wondering if this issue has been addressed in a webhook version later than 2023-04.

Ray14_0-1693451152493.png

 

Replies 2 (2)
Liam
Shopify Staff
Shopify Staff
1897 202 577

Hi Ray14,

 

I believe this is expected behaviour - in this case it appears as though there is one discount with a total value of $10 and there's no indication that this discount applies to a specific product, or that it should be split 50% between both products/ fulfilment locations. The API isn't aware that any additional calculations or changes need to happen to the discount amount or value so it appears that it's just applied as is. If you do want the discount to be split in proportion to the value of the different parts of the order that are fulfilled separately you may need to build that functionality in separately. 

 

Hope this helps,

Liam | Developer Advocate @ 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

Ray14
Shopify Partner
19 0 0

Hi Liam,

Thanks your response.

I manually fulfilled the order at Shopify order admin page so probably it isn't an API issue.

I have had a look at the dev doc and the definition is "The discounts that have been allocated onto the line item by discount applications, not including order edits and refunds."

Does this mean that if the order that contains discount is split fulfilled at the back-end of Shopify,  'discount_allocations' onto the line item is set with the value of full order discount amount ($10), however, it is set with the value of discount amount for this specific line item ($5) by discount applications? 

 

Thanks

Ray