Cannot get correct tax from order rest API after edit order item

Highlighted
New Member
4 0 0

I have a problem when I calling Order rest API(version 2020-01) to get the order info after changing the order item quantity in the admin page, this is the scenario:

1. Create a new order with 1 product A, product A price is $1000, Tax GST 5% is $50.00, Tax QST 9.975% is $99.75

 

2. Go to admin page and edit the order, change the product A quantity from 1 to 2, and then save the order. Now Tax GST 5% is $100.00, Tax QST 9.975% is $199.50. All order info is correct when I call the order API.

 

3. Now I edit the order again, change product A quantity from 2 to 1 and save the order, I can see the both Tax GST and QST have been changed back to the old value(Tax GST 5% is $50.00, Tax QST 9.975% is $99.75) in the page. 

 

4. Call the order API and check the order data again, in the "tax_lines" field, it still keep the GST as $100.00 and QST as $199.50; in the "line_items" field, it still keep the Quantity as 2, GST as $100.00 and QST as $199.50; in the "refunds" field, it has 1 record refer to the line item product A, the Quantity as 1 is correct, but for the tax, it only has a "total_tax" field and combines all taxes total as $149.75, I cannot get the correct tax GST and QST amount from this API. 

 

Can somebody tell me how to fix this issue? 

 

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 115

Hi @Simon_Liang ,

 

This is not a bug or issue - this is merely how Shopify normally handles refunds.

 

When using Order Editing, if you are removing a line item from an order or decreasing the quantity of an item in the order, it is the equivalent action of creating a refund for that order. In Shopify, when a refund is made for an order (either a partial refund or a full one), the original 'total_price' and 'total_tax' of the order remains the exact same as it was before. Instead, there is a new field added to the order called "refunds", and this field contains the value of the total price and total tax that is being refunded out of the order.

 

Any partner app or API client that wants accurate information on the total sales from an Order that has had a refund (or Order Edit removing items) associated to it must always subtract the value of the 'total_price' and 'total_tax' of the order with the values obtained in the new 'orders.refunds' field.

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
New Member
4 0 0

Hi @hassain , 

 

If you look at Shopify Order API, you will find only a "total_tax" field in refund item, there is not a separated discount field in refund item, you can only get the total taxes amount not each tax amount. If there is only one tax item, it should not have this issue. But if there are multiple taxes, and you want to calculate each tax amount, you will have this problem.  You can check my screen shot as below: 

 

image.pngimage.png

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 115

Hey @Simon_Liang ,

 

Thanks for the screenshots. It has helped made more clear the specific issues you were referring to.

 

This is a known limitation - as of right now with the Shopify platform, refunds do not take into account the tax breakdowns (only shipping costs vs total line item costs). Meaning that Shopify does not specify within a refund how much of that refunded amount is going towards the overall tax of the line items versus how much is going to the subtotal cost of the line items, and therefore it also does not break down how much of that refunded amount goes to each of the different taxes. In order to figure this out, you would need to manually calculate this information on your end.

 

This is definitely functionality that has been requested by other merchants, so in the future it is possible something we will look into building. I would keep an eye out to Shopify's release notes and changelogs to see if this functionality comes out.

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes