'Extra Tax added to order created via WooCommerce Rest Api

I am having issues with order total where order is created using woo api (/wp-json/wc/v3/orders). My tax setting says "Yes, I will enter prices inclusive of tax". But when an order is created via api, tax is added on top of total amount passed for line item. Please note I don't have any issue with tax where order is directly created on my website. I am not sure why tax is applied on line items total ?? Anyone please help. Also, please note that I am unable to make any change in the request message as it originates from an external marketplace .. I need to know what is know if any .. and how to fix it .. is there a filter/hook i can use to avoid this happening with orders created via api

Sample request:

Sample request

Order created in woocommerce:

Order created in woocommerce

woocommerce tax settings:

woocommerce tax settings



Solution 1:[1]

The solution to this problem is the total-field in your request. As soon as you provide a total the tax calculation will fail as in your example.

So just remove total from your sample request and everything will work!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 After_8