FROM CACHE - en_header

Product Cost from API - Verify

Solved
MeasuredInc
Shopify Partner
12 0 0

Hi Shopify Team,

 

Could you please confirm if the API calls made below are correct for getting the Product Cost. While comparing the product cost extracted from the calls below to the "Cost" field in the Shopify UI, they are not aligning.

 

Please the urls of the calls made for getting cost currently

 

Call 1 - "/admin/api/2019-04/orders.json "   -  We get the product id and variant id from this call at line item level

 

Call 2 - "/admin/api/2019-04/products.json" –  We make this call using the productid. Then once we receive json object, we extract inventory id using variant id.

 

Call3 - " /admin/api/2019-04/inventory_items/{inventory_item_id}.json"  We make this call using the inventory item id, and extract cost.

 

Is there something wrong with this approach ?

 

Accepted Solution (1)

Accepted Solutions
Measured
New Member
1 1 0

This is an accepted solution.

Hi,

 

I am not able to see any "cost" present with lineItem's object. But, there is "price" present with lineItem. So, is this "price" same as the "cost" which we get from 

/admin/api/2019-04/inventory_items/#{inventory_item_id}.json

 Thanks.

View solution in original post

Replies 3 (3)
Visely-Team
Shopify Partner
1843 210 472

Hey there,

 

Why wouldn't you just get the cost you have at the line item level (you also have discounts and tax information)? Would you shed some light on what you are trying to achieve.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
Measured
New Member
1 1 0

This is an accepted solution.

Hi,

 

I am not able to see any "cost" present with lineItem's object. But, there is "price" present with lineItem. So, is this "price" same as the "cost" which we get from 

/admin/api/2019-04/inventory_items/#{inventory_item_id}.json

 Thanks.

Philhutch
New Member
1 0 0
This does not work as the cost price is a lot less then the price shown in line items.
If you look at cost price in the products csv export this is the price needed. Not all clients fill this in but this would be the price I would look for and the solution above about looking it up in the inventory seems the only way to do that?