Get updated total of an individual line item from the Storefront API

basnetg
Visitor
2 0 0

Hi!

 

I'm trying to show the updated price of a line item when the quantity of it has been modified. The Storefront API only exposes the originalTotalPrice field which has the original price. How do I query for and show the updated price of line items.

 

I see that there is quantity and currentQuantity, would be nice if there was a similar currentTotalPrice.

 

https://shopify.dev/docs/api/storefront/2024-04/objects/OrderLineItem

 

*Not related to javascript but could not find an appropriate label

Replies 2 (2)

MaxDesign
Shopify Expert
213 15 83

In what context are you trying to update the price of a line item? It will help if we understand what you are trying to achieve in the very first place. 

Reach out to me at admin@maxdesign.expert
basnetg
Visitor
2 0 0

My storefront just reads data from the API. It does not update. Updates can happen from the Shopify admin/dashboard. The reason could be anything, the customer requested to update their order, a line item was low on stock, really anything.