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.
Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023