Shopify API: COGS values

dioufjunior
Shopify Partner
1 0 0

HI
I need to value the COGS (cost of goods sold) field from the management system using the API. But reading the documentation I don't see the existence of this property in GET and POST calls (/admin/api/2023-04/products.json).
I would like to know if it is feasible and how to implement it.
Thanks in advance.

 

Replies 2 (2)

Liam
Shopify Staff
2731 302 777

Hi Dioufjunior,

 

As you've seen there isn't a direct endpoint for accessing COGS on a product directly. One option you could take would be the store the COGS value as a metafield on the product resource and then manage these values for products with the Admin API. Alternatively there are several third-party apps such as TrueProfit and Mipler available in the Shopify App Store that allow you to manage COGS. These apps provide their own APIs that you can use to integrate with your management system. 

 

Hope this helps!

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

t3chlady
Shopify Partner
10 0 1

Hello Liam and Dioufjunior,

 

The COST of a product is stored in Inventory_Items and you need the InventoryID to retrieve the unit cost.

 

You are correct that there is no direct request, you have to get the inventoryID first, then look it up in InventoryItems.

 

Jean