FROM CACHE - en_header

Get historical product cost per item (as of the time of the order)

ClementBR
Shopify Partner
128 2 33

Could Shopify enhance the line item object to include a cost field?

This is so that we can access the historical cost of the item at the time of the sale.

At the moment, we can look up the price from the inventory item, but this is the current as of now.

 

 

Replies 8 (8)
Alex_B
Shopify Staff
Shopify Staff
56 4 29

Hey ClementBR!

 

I have not heard of any plans to add cost to an order's line item.

However, you could definitely perform this mapping as an app by verifying costs in response to an order webhook.

Additionally, for orders that existed before your app was installed, you could compare the updated_at fields on both the order and the inventory_item to determine if the cost has potentially changed since the order was placed.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

ClementBR
Shopify Partner
128 2 33

Thanks Alex, I thought about that but it's really not ideal.

What we want is line_item.cost, just like line_item.price

 

My understanding is that the Shopify margin reports are using the historical cost of the line item (at the time of the sale), so I would assume that it is already captured somewhere in the order data.

 

Consider this an official feature request 🙂

Michael_Thomas
Tourist
11 0 7

This would be very helpful. I would also like to see this implemented.

justinGP
Tourist
3 0 3

I'd like to third this request. Right now to calculate order cogs you need to go:

Order -> line_item -> variant -> inventory_item -> cost

And, as was pointed out in this thread, that is based off the current cost and not the cost at the time of the transaction.

Having order.line_item.cost would be very helpful as an app developer.

Peter_DhatmaApp
Shopify Partner
8 0 2

I agree, this should be considered and added by Shopify.

The solution proposed by Alex_B does not take into consideration that an item cost can change multiple times while several orders are placed.

Thanks,

Peter

savana1
Tourist
4 0 0

Please provide an update on this. This is really a necessity. 

Peter_DhatmaApp
Shopify Partner
8 0 2

Totally agree! This should be considered for implementation asap by Shopify. 

+1

 

savana1
Tourist
4 0 0

Are there any updates on this? I have seen multiple threads about this over the last few years and little to no action/update on shopify's end, even though the data exists in shopify. We need this available to properly calculate margin and is a necessity to our business.