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)
Gravy_Sales
Shopify Partner
55 1 6
Not yet seeing the "cost" on my store when I use the below format, with 12345 being inventory_item_id ... any ideas?
myshop.com/admin/inventory_items/12345.json
High ticket item store owner and Google Shopping Ads specialist.
Shopify App: Gravy App that lets you build social proof with photo reviews, sales/cart pop-ups and referrals.
ClementG
Shopify Partner
660 0 144

Repricer Admin, we noticed the same thing when hitting the url in your browser, but if you use the API, the cost property will be returned. It seems pretty inconsistent...

It's missing in webhooks though. I'm waiting for a fix on that one...

Gravy_Sales
Shopify Partner
55 1 6

Ah, thanks for confirming that... maybe/hopefully this is by design, to protect costs of shop owners. 🙂

So, just to confirm I have this right... this should work?  On my dev store I'm still having no luck after iterating through $cost ...

$inv_request = $shop->api()->rest('GET', '/admin/inventory_items/12345.json');  
$cost = $inv_request->body->inventory_item->cost;

High ticket item store owner and Google Shopping Ads specialist.
Shopify App: Gravy App that lets you build social proof with photo reviews, sales/cart pop-ups and referrals.
KieranMasterton
Shopify Staff (Retired)
Shopify Staff (Retired)
22 0 12

Hi all,

For those implementing product cost in their apps we have just released a guide to supporting the new feature: https://help.shopify.com/en/api/guides/supporting-product-cost

Also, regarding the webhook issue Clement raised, we have just pushed an update which resolves this issue and also exposes the cost property to admin authenticated requests in the browser. Thanks for your patience while this was resolved.

ClementG
Shopify Partner
660 0 144

Thanks Kieran, I can see the cost in the webhook now.

Zapfor_Apps
Shopify Partner
83 1 11

Hi Kieran,

I noticed when merchants update the cost per item field with CSV product import, the inventory_items/update webhook is not triggered. Is this by design? If it is, what do you recommend apps should do to detect changes in costs? 

Thanks.
Sam

SimplyCost - Add costs and track profit (https://apps.shopify.com/simplycost)
KieranMasterton
Shopify Staff (Retired)
Shopify Staff (Retired)
22 0 12

Hi Zapfor Solutions, thanks for the heads up on this, we're investigating the issue and will report back as soon as it's solved.

Ameed_Akhdar
New Member
2 0 0

Hey guys!

 

Is there any way to record cost of previous goods sold prior this feature was introduced? 

 

Thanks!

Zapfor_Apps
Shopify Partner
83 1 11

Hi Keiran,

Hi Zapfor Solutions, thanks for the heads up on this, we're investigating the issue and will report back as soon as it's solved.

I'd like to check if you have got any update regarding bulk import costs does not fire inventory_items/update webhooks?

Sam

SimplyCost - Add costs and track profit (https://apps.shopify.com/simplycost)
ClementG
Shopify Partner
660 0 144

We have deprecated our own cost field in favor of this new built-in field.

However, some merchants have reported to us that the field doesn't allow $0 cost.

It might seem strange at first but there are some valid scenarios that warrant a $0 cost, such as items on consignment or free items.

Is it possible to change the field to allow for this?

UPDATE:

It's worth noting that it is possible set a product price at $0 so it only makes sense to allow for the cost to be $0 as well.

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

@clement interesting question, can I ask for more context on the use case of a 0.00 cost? The cost can be set to null via GraphQL (coming to REST shortly) but I'm guessing perhaps your merchant has a specific use case for zero cost?

@sam this is still in the works, sorry for the delay and thanks for your patience. 

Adriano_S
Tourist
3 0 3

As a merchant, I'd like to add my vote to Clement's request for a 0.00 cost.

We often have promotional inventory provided by suppliers free of charge, which we then re-sell. These sales should be recorded as 100% profit. It's my understanding that a product with a "null" cost field is ingored in the profit reporting.

ClementG
Shopify Partner
660 0 144

Hi Kieran,

Would you like me to put you in touch with a merchant that requires $0.00 costs?

Like Adriano said, setting the cost to null doesn't work for reporting. A null cost is semantically different from a $0 cost. If the cost is null, we might want to exclude from profit reports or assume the margin is 0.

 

PaulNewton
Shopify Partner
4878 412 1053

Seeing what type of information can be stored in this field via admin as is shopify tradition to be able to repurpose everything as a store needs with unexpected data. Just like most shopify handling of currency as pennies:

  • cost can't be less than 0.01 , e.g. foodstuff  $/lb to$/oz, etc bulk.
  • admin will automatically round off with very little warning eg. 0.054
  • not relevant just trivia: can't store a negative number 

 

Finally Combinable Discounts - EARLY ACCESS ONLY - Use Free Shipping With Other Discounts

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org
Problem Solved? ✔Accept and Like solutions to help future merchants
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
John_R
New Member
1 0 0

HI Kieran,

Please be informed that Google has already made the decision that the "Cost" field is important with how an item is presented for sale.  

We need to map it properly to the Google Merchant Center "Cost_of_goods_sold" field so that we can optimize our marketing and the selling of our items.

Please confirm how we can do that.

KarlOffenberger
Shopify Partner
1873 184 886

Subscribed

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

Kieran, any update on allowing $0 cost?

I've just been pointed to another obvious use case by a merchant: digital products.

It's hard to argue with that one!

ClementG
Shopify Partner
660 0 144

And yet another case with a merchant selling services.

Hello Shopify? Can you please allow $0 cost? It's impacting real merchants and real scenarios.

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

Hi Clement, sorry for the delay in replying over the holiday period. The development team working on product cost are in the process of implementing the zero cost option and it should be available very soon, I'll update the thread as soon as the feature is shipped. Thanks for your patience.

ClementG
Shopify Partner
660 0 144

Thanks Kieran, great news!

Any update on capturing the historical cost on the order line items?