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)