This topic and discussion board has been closed.
To stay updated on announcements related to the API please review this post about the new Developer changelog.
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.
Just got another merchant asking about computing historical COGS.
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
Awesome Kieran! Big thank you to y'all.
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.
Thanks to all who participated in our AMA with 2H Media on planning your 2023 marketing bu...
By Jacqui Mar 30, 2023Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023