Product API does not contain 'Cost per item' property

Solved
ViSoft-Thomas
Tourist
7 0 1

Hi there,

 

I was wondering why the Product API does not return cost per item. You can set it in the admin panel of your Shopify store, but cannot read/set it from the API. Is there a specific reason for this or is it not yet implemented? Thank you

 

Sincerely,

 

Thomas

Accepted Solution (1)

Accepted Solutions
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
624 104 178

This is an accepted solution.

Hey @ViSoft-Thomas ,

 

This "cost" field is a property of the Inventory Item resource/endpoint of the Shopify Admin API, not the Product resource/endpoint. Every Product in Shopify has one-to-many Product Variants assigned to it, and each Product Variant has an 'inventory_item_id' field. With this 'inventory_item_id' you can use the Inventory Item endpoint to read/set the "cost" of the item.

 

Read this documentation here on how to read/set the "cost" of an inventory item via the Shopify Admin API: https://shopify.dev/docs/admin-api/rest/reference/inventory/inventoryitem

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

View solution in original post

Replies 5 (5)
hassain
Shopify Staff (Retired)
Shopify Staff (Retired)
624 104 178

This is an accepted solution.

Hey @ViSoft-Thomas ,

 

This "cost" field is a property of the Inventory Item resource/endpoint of the Shopify Admin API, not the Product resource/endpoint. Every Product in Shopify has one-to-many Product Variants assigned to it, and each Product Variant has an 'inventory_item_id' field. With this 'inventory_item_id' you can use the Inventory Item endpoint to read/set the "cost" of the item.

 

Read this documentation here on how to read/set the "cost" of an inventory item via the Shopify Admin API: https://shopify.dev/docs/admin-api/rest/reference/inventory/inventoryitem

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

ViSoft-Thomas
Tourist
7 0 1
ERMPerformance
New Member
2 0 0

This sounds like a nice work around. I cannot seem to find the product ID you're referring to in the variant section.

I am trying to add the product cost so that it shows up in zapier when I'm pulling information. Is it possible to do this and where could this be added in or hard coded in on the products backend so it would show up in a place like zapier?


Thanks,


ERM

Screen Shot 2021-04-20 at 15.07.46.png

tezza1976
New Member
1 0 0

Did you find a solution to this please? I need to add supplier cost to email sent by Zapier when an order is placed and I cant find an easy way of doing it? Thanks in advance

Gabe_Stillwater
Excursionist
12 0 11

@tezza1976   @ViSoft-Thomas  @ERMPerformance  @hassain 

 

I ended up figuring this out for the Celigo Integrator - not sure if it will work for other mapping software like Zapier - but this is what I ended up doing to get it to work for standalone products and matrix child items for mapping the cost.

 

The endpoint I send to is: "product.variants[*].cost"

 

I have tested this with our set up and it works great. Not all the endpoint locations seem to be visible from the API call out - so I ended up just testing it this way and it functions. Again this endpoint location worked for individual and matrix/child products.