New cost property on InventoryItem

KieranMasterton
Shopify Staff (Retired)
Shopify Staff (Retired)
22 0 12

On Thursday October 25th, Shopify will start introducing Product Cost. This feature enables merchants to record the unit cost of their variants, track margin, and report on product performance within Shopify. This feature will roll out to all stores over the next few days. 

Merchants will see a new cost per item field when editing variant pricing and will be able to bulk update this cost via the product CSV importer and the product bulk editor. There will also be changes to analytics, including the addition of new Profit Margin, Cost of Goods, and Gross Profit reports.

In order to enable our partners to leverage this feature in their apps we are exposing a new cost property on the InventoryItem. Please see the examples below for implementation details.

GraphQL

To pass Shopify the unit cost of a variant via the GraphQL Admin API you will use the productVariantUpdate mutation, see example below.

Mutation:

mutation productVariantUpdate($input: ProductVariantInput!) {
 productVariantUpdate(input: $input) {
   userErrors {
     field
     message
   }
   productVariant {
     id
   }
 }
}

Input variables:

{
 "input": {
   "id": "gid://shopify/ProductVariant/35437260802",
   "inventoryItem": {
     "cost": "25.00"
   }
 }
}

For more information about variant mutations please see our documentation.

REST

To pass Shopify the unit cost of a variant using our REST Admin API you will use the InventoryItem endpoint, see example below.

PUT /admin/inventory_items/#{inventory_item_id}.json
{
 "inventory_item": {
   "id": 808950810,
   "cost": "25.00"
 }
}

For more InventoryItem endpoint information see our documentation.

As always, if you have any questions, or concerns, please don't hesitate to reply in the thread below.

Replies 43 (43)
ClementG
Shopify Partner
660 0 144

Just got another merchant asking about computing historical COGS.

KieranMasterton
Shopify Staff (Retired)
Shopify Staff (Retired)
22 0 12

Good morning Clement and others who have requested an option for $0 cost. I'm now pleased to share with you that this is now available both in the admin and via the Inventory Item API.

In terms of historical cost on order line items, this is something the team are considering but not something we have a timeline for at this point. We'll keep you posted as we explore this further. Additional information about your use case for this data is always super useful in these discussions, so please share!

Thanks,

Kieran

KarlOffenberger
Shopify Partner
1873 184 886

Awesome Kieran! Big thank you to y'all.

Liked this post? You might also like our fantastic upsell apps Candy Rack, Last Upsell post-purchase and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
ClementG
Shopify Partner
660 0 144

Fantastic thank you.

Regarding the historical cost scenario, for us it's for reporting accurately costs over time.

It's very much the same as reporting revenue over time, which uses the historical retail prices of course.