When editing an order, removing some line items and adding others, the order total price changes accordingly on the interface.
However, when fetching through the API, the total_price (and other price related fields) is showing the sum of previous total price with the new one, which doesn't make sense at all.
How can we get the updated order total price from the API?
Do we have to calculate it somehow?
Attaching screenshot of interface, and the relevant parts of API response down in the bottom:
The order price before (API):
... "total_price": "168.48", "subtotal_price": "144.00", ...
The order price after the edit (API):
... "total_price": "317.07", "subtotal_price": "271.00", ...
Solved! Go to the solution
This is an accepted solution.
Hi there,
This is the expected behaviour of the orders API. The "total_price" field will return to you the total price of all line_items including those which have been refunded. If you would like to retrieve updated values for the order (i.e. total_price) you should query the GraphQL Admin API with the field `netPaymentSet`
Cheers
This is an accepted solution.
Hi there,
This is the expected behaviour of the orders API. The "total_price" field will return to you the total price of all line_items including those which have been refunded. If you would like to retrieve updated values for the order (i.e. total_price) you should query the GraphQL Admin API with the field `netPaymentSet`
Cheers
So I have to use two APIs in order to get an answer for this simple question?
That doesn't make any sense.
If it is important enough to put it in GraphQL, why not adding this in the REST API?...
Is this in the roadmap?
The order items and quantities aren't updated either. How do we get this via API?
I am using `current_total_price` that reflects refunds and returns. This field is documented; however, there is no such thing for `total_line_items_price`, and in my case, I am forced to calculate it using the `refunds` object data.