Price doesn't get deducted from total_price field after editing an order

Solved
Lulu1
Shopify Partner
29 1 30

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:

edited-order-summary.jpg

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",
...
Accepted Solution (1)
sd_
Shopify Staff (Retired)
Shopify Staff (Retired)
51 10 7

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

 

View solution in original post

Replies 4 (4)
sd_
Shopify Staff (Retired)
Shopify Staff (Retired)
51 10 7

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

 

Lulu1
Shopify Partner
29 1 30

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? 

EBC
Shopify Partner
9 0 4

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.

Matkatus
New Member
1 0 1

The order items and quantities aren't updated either. How do we get this via API?