Development discussions around Shopify APIs
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?
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.
The order items and quantities aren't updated either. How do we get this via API?
Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023