Updated Deadline: Aug 1st -- [Deprecation] Important changes to ProductVariant, Refund and Fulfillment APIs

Ryan
Shopify Staff
Shopify Staff
499 42 120

UPDATE JAN 2: 

https://ecommerce.shopify.com/c/api-announcements/t/deadline-reminder-important-changes-to-productva...

UPDATE SEP 14 

Hey Devs!

We've recently shipped a new change to help with identifying calls that we consider deprecated.  We've added a new header to return on these calls:

X-Shopify-API-Deprecated-Reason

If you receive one of these headers in your response, this means Shopify considers that a deprecated call.  This is an effort to allow these calls to be machine readable, and loggable, in order to assist developers in identifying the areas that need to be updated.

Examples of calls that will return this header:

  • Creating a fulfillment without a location
  • Creating a product with variants that have "inventory_quantity"
  • Creating a new variant on a product that has "inventory_quantity"
  • Updating a variant with "inventory_quantity_adjustment"
  • Updating a variant with "inventory_quantity"

 

Happy Coding!

 

UPDATE JUNE 28: 

Hey Devs,

Just want to let you know that we are extending the deprecation deadline from July 1st to August 1st.  There will be a new post tomorrow with more details, but we just wanted to get it out there to maybe relieve some of the stress you are feeling headed into the weekend.

Most, if not all of your questions will be answered in the post tomorrow so try to save any queries for that!

Cheers All!

Ryan

 

Hey Devs,

Shopify is preparing to release multi-location inventory features to all merchants this summer. All apps that create fulfillments or manage inventory will need to be updated by July 1st, 2018, to remain functional on shops that track inventory across multiple locations.

Key dates

July 1st, 2018

  • Apps will no longer be able to create fulfillments without specifying a location
  • Apps will no longer be able to set inventory on the Product/Variant APIs

Migrating to support multi-location fulfillments

Shopify fulfillments are currently “location unaware”, meaning that when an app creates a fulfillment and fulfills an order, Shopify decrements the inventory with no concept of which location that inventory should be decremented from. In order to support merchants with inventory allocated across multiple locations, apps will need to include a location_id when creating fulfillments.

For details on how to migrate your apps to support multi-location, see our Multi-Location Fulfillment Migration Guide.

Migrating to support multi-location inventory

Currently inventory is set and adjusted on the product variant and is not tracked by any particular location. In anticipation of multi-location inventory, Shopify has released a new Inventory API, which includes two new endpoints: Inventory Item and Inventory Level. The Inventory API will allows apps to effectively manage inventory quantities across multiple locations.

For details on how to migrate your apps to support multi-location inventory, see our Multi-Location Inventory Migration Guide.

We’ll keep you up to date as we continue to make improvements to our platform’s multi-location fulfillment and inventory management capabilities, so you can continue to build the best apps to help extend these new features.

If you have any questions about this change, please read our detailed FAQ or contact deprecations@shopify.com.

 

Thanks,

Shopify Apps Team

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Replies 149 (149)
tomn68
New Member
1 0 1

Is this a revised schedule? I thought the last email from February where it stated May 7 as option to enabled multi-location inventory and then Jan 1 2019 where it goes read only.

Just so I'm clear, if we use the product variant to track inventory levels but do not use them to track muli-location inventory levels, does this new July 1st date effect us in this use case?

 

Tom

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

It would be a lot better if you guys could allow us to enable multi location on our development stores before releasing this nice addition to the grand public. 

We are authoring an inventory management platform with a nice integration with Shopify. This is a very important change we need to get right from the start and we don't have much time left. 

Another question which came up from our engineering team is: how are existing merchands who don't have multi-location enabled going to be affected? Will the deprecated inventory APIs be disabled for this merchands cohort as well? 

 

Thanks in advance.

Tahar from Stock&Buy

Ryan
Shopify Staff
Shopify Staff
499 42 120

Hi Tahar, 

Stay tuned for details on enabling multi-location features on development shops.  I don't have any public details to share except that it will be available to all partner developers before it launches to merchants.

 

For all,

If you have specific implementation questions for the migration please contact deprecations@shopify.com.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Thanks Ryan. Appreciate the super fast response. 

By the way, we did send an email to deprecations@shopify.com but received no response 🙂

Ralph-HA
Shopify Partner
100 6 41

Hi Ryan,

   Thanks for all the awesome detail. 

    I have a quick question about the affect of inventory on the orders api.  There is a flag on the create order api call called inventory_behavior.  Do the changes made that will affect the inventory levels on the Product API have an affect on this?  I know they are totally different API endpoints but I wasn't sure if the underlying behavior would cause any changes on Order api as well.

Thanks!

Co-Founder / Developer at Highview Apps
Our Shopify Apps: EZ Exporter | EZ Inventory | EZ Importer | EZ Notify | EZ Fulfill
MeltinBit
Shopify Partner
5 0 0

Hello, after reading the post i realized that for the FulfillmentApi the only change that's need is to provide a location_id.

The question is: where do i find the location_id? I mean no location has been specified right now for products and variants, so how can they be associated to a Location? Is this something that happens by default for all the inventory?

Thanks!

Ryan
Shopify Staff
Shopify Staff
499 42 120

Hi Ralph,

There is no change to the orders API.  If you specified inventory_behaviordecrement_obeying_policy Shopify will handle all of the inventory decrementing using the new APIs.

 

Hi Fabio,

You can get the location_id from https://help.shopify.com/api/reference/location#index to see them all or from https://help.shopify.com/api/reference/inventorylevel to see locations for a specific item.

 

Ryan

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Paul_McWhinnie
Shopify Partner
18 0 4

Hello Ryan O,

Two issues with this:

1. This change violates the golden API rule.. once publised, behaviour should not change or break. Why not allow us to continue setting variant -> inventory_quantity and under the hood just update the appropriate inventory item/level for the default Location?

2. This change will incur extra API calls.

 

Upon further review...

(a) https://help.shopify.com/api/tutorials/inventory-migration-guide#affected-apis
Affected API | Changing behaviour 

Setting inventory_quantity will adjust a product variant's inventory at its location that has the lowest ID. The inventory at that location will be adjusted so that the sum of inventory across all locations matches the value set by inventory_quantity. Use the Inventory Level endpoint instead.

(b) https://help.shopify.com/api/tutorials/inventory-migration-guide#deprecation-schedule
Deprecation Schedule

July 1, 2018
Apps will no longer be able to set inventory_quantity or inventory_quantity_adjustment on the product variant.

(a) and (b) seem to contradict each other or does "Setting inventory_quantity.." refer to current behaviour?

 

Thanks,
Paul

Poul_Poulsen
Shopify Partner
23 2 18

So with a new shop where you have to add lets say 100 product calls to the api, you now have to add that x times for each variant due to the inventory level getting its own endpoint ? Isn't it possible to just send the inventory items with the variants within the same call for when you add a new product with variants ?

Metafields is a myth...
Hari2
Shopify Partner
6 0 1

Hi,

I use a private app (not Third party apps) to make API calls to my store endpoint to update inventory quantity and fulfillment details for the order. fulfillment_service is set to "manual" for all the products/variants. I fulfill the products manually and use my custom application to update Shopify with the required details.

Question:

1. Is location_id still mandatory in the fulfillment API even when private apps are making the call to create the fulfillment records ?

2. When the product is set to fulfillment_service = manual, can i update the inventory levels using Inventory API without specifying the location_id.

bardia
New Member
15 0 0

Hi Ryan,

Could you please update the post's links to the two Migration tutorials? They point to 404.

Thanks,

Bardia

Robert_Tolton1
Tourist
9 0 1

@Hari - I too would like to know this, I have a private app performing fulfillments currently. It's slightly concerning that neither the fulfillment migration tutorial nor the API docs for locations are currently available? Is locations something you opt-in to?

Ryan
Shopify Staff
Shopify Staff
499 42 120

Hey All,

Fulfillment Migration Guide, Locations, if these don't work for you, try resetting your cache.  The  URLs were only down for about 30 minutes for the migration to the new developers site.

Question:

1. Is location_id still mandatory in the fulfillment API even when private apps are making the call to create the fulfillment records ?

2. When the product is set to fulfillment_service = manual, can i update the inventory levels using Inventory API without specifying the location_id.

You must always include a location ID, doesn't matter about private apps.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JAS_Technology
Shopify Expert
84 0 52

I noticed the same thing as Paul and mentioned it here. Important to get an answer. 

Happy to hear about your crazy ideas.
Ryan
Shopify Staff
Shopify Staff
499 42 120

Responded to your other thread as well:

 

You have to include a location ID even if the shop only has a single location.  The changed behaviour on Product and Product Variant went into place when that document was pubished in late 2017, and will only continue to take place in a grace period for grandfathered apps after the release of multiple locations.  This is in order to mitigate the affect on merchant's inventory if the apps do not migrate in time.  I will update the migration guide to be more clear about this.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

We are still unclear about how the new API will work. Here are a few issues / questions we are currently having a very hard time with:

  1. Is multi location equivalent to multiple locations? What I mean is, we have a test store with three locations but the has_multilocation flag is still set to false. Is there a place in the admin area where we can turn this on? Can one define multiple POS locations with the has_multilocation flag set to false? 
  2. Related to point 1 above, do you have an ETA as to when we can we set the multi location flag?   

I would be helpful if you can answer these questions in a timely manner, we have one engineer staying idle waiting for these points to be clarified 🙂

Thank you in advance.

Tahar.

Ryan
Shopify Staff
Shopify Staff
499 42 120

You can test the multi-location feature by creating a new development store from your partner account and checking the box here:

Once your store is created you can go to settings > locations and enable the features.

For 1.  Even with the flag off, you may have more than one location.  This could be from POS locations, or automatically created from a fulfillment service

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Thanks a lot Ryan. That definitely helps. In case of a store with multiple POS locations and the has_multi_location flag set to false, how will Shopify behave? Would inventory and orders be handled same as if the multi-location flag was set?  

Again thanks for all the clarifications.

JAS_Technology
Shopify Expert
84 0 52

Hi Ryan O. Here is another question. When creating a product via the API or creating a new variant via the API do we, in essence have to create variants with zero inventory and then after the call completes we set inventory levels for the necessary location(s)? So the new flow of product creation would be:

  1. Setup JSON for a full product including properties, images, variants, metafields, etc...
  2. POST to /admin/products.json
  3. Inspect response JSON to get inventory item ID's
  4. For each variant's inventory_item_id, submit a POST to inventory_levels/set.json to set its available inventory

This right? Make sense? No way to create a product with inventory levels in one call anymore?

Happy to hear about your crazy ideas.
Andrii
New Member
2 0 0

Hi Ryan,

Can you help me, I have a method that set inventory_quantity. The question is: what should I do now? Do you have some tutorial what to do in this case? For now I haven't any locations for my application.

Thanks, Andrii.

Ryan
Shopify Staff
Shopify Staff
499 42 120

Andrii, check out the inventory migration guide in the original post.  You will need to convert to the new inventory APIs.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Andrii
New Member
2 0 0

Ryan, I read it, but I can't understand how to do it. Should I manually create location level record for each variant?

Also this link is not correct maybe (https://help.shopify.com/api/reference/location)?

Ryan
Shopify Staff
Shopify Staff
499 42 120

I'm not sure I understand your question Andrii, and this forum isn't the best platform for 1:1 support.  Could you email deprecations@shopify.com and add some more details to your request.  Thanks!

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JAS_Technology
Shopify Expert
84 0 52

Hi all, this change is tough on developers. I would actually suggest talking this out here would be great! 

Happy to hear about your crazy ideas.
Ryan
Shopify Staff
Shopify Staff
499 42 120

So the new flow of product creation would be:

  1. Setup JSON for a full product including properties, images, variants, metafields, etc...
  2. POST to /admin/products.json
  3. Inspect response JSON to get inventory item ID's
  4. For each variant's inventory_item_id, submit a POST to inventory_levels/set.json to set its available inventory

This right? Make sense? No way to create a product with inventory levels in one call anymore?

This is correct.

Hi all, this change is tough on developers. I would actually suggest talking this out here would be great! 

The email is handled by a whole team, and can help with specific shops, request-ids, and other private data.  General questions are fine here though.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Ryan
Shopify Staff
Shopify Staff
499 42 120

Thanks a lot Ryan. That definitely helps. In case of a store with multiple POS locations and the has_multi_location flag set to false, how will Shopify behave? Would inventory and orders be handled same as if the multi-location flag was set?  

Again thanks for all the clarifications.

When the merchant opts in to multiple locations (aka enabling the flag), this allows the merchant to create new locations, and automatically connects all of their existing inventory to the shipping origin location.  All other behavior is already implemented and functioning currently.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Ryan
Shopify Staff
Shopify Staff
499 42 120

Paul,

1. This change violates the golden API rule.. once publised, behaviour should not change or break. Why not allow us to continue setting variant -> inventory_quantity and under the hood just update the appropriate inventory item/level for the default Location?

2. This change will incur extra API calls.

1. This is why we gave as long of a lead time as possible, we recognize that this is a large change for developers and will continue to work with you to get it done.

2.  If your apps are having issues being rate limited due to the new multi-location features, please reach out to deprecations@shopify.com and we can discuss your individual use-cases.

Upon further review... (a) and (b) seem to contradict each other or does "Setting inventory_quantity.." refer to current behaviour?

The wording has since been updated to clarify: "The following behaviors are temporary and exist only to help you migrate to the Inventory API. Updating inventory using the Product and ProductVariant APIs is deprecated, and should no longer be relied upon to update inventory."

 

Poul,

So with a new shop where you have to add lets say 100 product calls to the api, you now have to add that x times for each variant due to the inventory level getting its own endpoint ? Isn't it possible to just send the inventory items with the variants within the same call for when you add a new product with variants ?

In order to set the inventory level on a new inventory item, yes you will need to make another call.  You cannot set the inventory level in the same call as creating the variant.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

Thanks a lot for all the help and insights you gave us so far. While performing our final acceptance tests, we found out that the `location_id` attribute of the order object is always set to `null` and instead, it is the fulfillement object which now holds the location from where the order is fulfilled. 

Will the `location_id` attribute of the order object be deprecated? 

Thanks in advance,

Kind regards,

Tahar

Paul_McWhinnie
Shopify Partner
18 0 4

Thank you Ryan,

I just noticed that SKU will also need special handling, incurring even more calls. The Product Variant API guide doesn't have SKU marked as deprecated fwiw.

Paul

JAS_Technology
Shopify Expert
84 0 52

Hey Paul,

Can you explain what you're seeing in more detail?

Happy to hear about your crazy ideas.
Paul_McWhinnie
Shopify Partner
18 0 4
Zapfor_Apps
Shopify Partner
85 1 11

Hey Ryan,

After 1st July, for a shop that does not enable multi-location inventory, will each variant of the shop linked to an inventory_item? Or inventory_item only present if a shop has multi-location inventory enabled?

EDIT:
It looks like all variants will have an inventory_item 🙂 irregardless multi-location inventory is enabled or not.

 

SimplyCost - Track profit and expenses
(https://apps.shopify.com/simplycost)
Ryan
Shopify Staff
Shopify Staff
499 42 120

Thanks a lot for all the help and insights you gave us so far. While performing our final acceptance tests, we found out that the `location_id` attribute of the order object is always set to `null` and instead, it is the fulfillement object which now holds the location from where the order is fulfilled. 

Will the `location_id` attribute of the order object be deprecated? 

Location_id on the order only exists if the order was made through a Shopify POS location.  These multi-location changes do not affect the Order API (this location_id was already there).

I just noticed that SKU will also need special handling, incurring even more calls. The Product Variant API guide doesn't have SKU marked as deprecated fwiw.

SKU will still be readable from the variant, but not writeable.  I'll look into a doc update for clarity.

After 1st July, for a shop that does not enable multi-location inventory, will each variant of the shop linked to an inventory_item? Or inventory_item only present if a shop has multi-location inventory enabled?

EDIT:
It looks like all variants will have an inventory_item 🙂 irregardless multi-location inventory is enabled or not.

Inventory Items and Inventory Levels have been released and implemented since February.  All inventory logic has been using them since then, and yes they are useable without multi-location enabled.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Liam_Hennessy
Tourist
6 0 2

Will the Liquid template variable variant.inventory_quantity be affected by this change?

Ryan
Shopify Staff
Shopify Staff
499 42 120

Will the Liquid template variable variant.inventory_quantity be affected by this change?

There are no liquid updates planned for the initial release of multi-location.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Conner
Shopify Partner
52 2 12

Hi,

Will I be able to set the availability for multiple inventory_levels at once? The documentation seems to show that we'll only be able to set the availability of one inventory_level at one time.

If so, this will dramatically increase the amount of API calls we have to make. Previously, we were adjusting inventory at the Product-level (which only included the VariantID and InventoryQty) to help reduce the number of API calls we have to make.

Thanks

Ryan
Shopify Staff
Shopify Staff
499 42 120

With the REST API, the only way to update multiple inventory levels in one call is by registering as a FulfillmentService and registering to be polled for inventory levels.

Using the new GraphQL Admin API however, you can easily update multiple inventory level in a single call (GraphQL doesn't use the concept of calls for rate limiting).  Example:

mutation {
  item1: inventoryAdjustQuantity (input: {inventoryLevelId: "gid://shopify/InventoryLevel/37685843?inventory_item_id=40011829139", availableDelta:3 }) {
    inventoryLevel {
      available
    }
    userErrors {
      field
      message
    }
  }
  
  item2: inventoryAdjustQuantity (input: {inventoryLevelId: "gid://shopify/InventoryLevel/37685843?inventory_item_id=40011857683", availableDelta:3 }) {
    inventoryLevel {
      available
    }
    userErrors {
      field
      message
    }
  }
  
  item3: inventoryAdjustQuantity (input: {inventoryLevelId: "gid://shopify/InventoryLevel/37685843?inventory_item_id=40011857875", availableDelta:3 }) {
    inventoryLevel {
      available
    }
    userErrors {
      field
      message
    }
  }
}

 

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Yuriy_Kravchuk
New Member
3 0 0

Hi,

1) What impact will it have on products for which inventory is not tracking?

2) How to fulfill orders with such products? We didn’t set up a FulfillmentService. It looks the only way, in this case, is fetch available locations and use one of them to set a location_id for the fulfillment?
Suppose we will set up a FulfillmentService soon, but if we are not on the schedule, need a way to create fulfillments.
 

Ryan
Shopify Staff
Shopify Staff
499 42 120

1) What impact will it have on products for which inventory is not tracking?

The inventory item will still have a location_id but will have available = null

example from my store:

{
  "inventory_levels": [
     {
        "inventory_item_id": 871696400403,
        "location_id": 13968900152,
        "available": null,
        "updated_at": "2018-05-22T14:50:57-04:00"
     }
  ]
}

 

2) How to fulfill orders with such products? We didn’t set up a FulfillmentService. It looks the only way, in this case, is fetch available locations and use one of them to set a location_id for the fulfillment?

You can still create a fufillment without registering as a fulfillment service, and pass the required location_id parameter.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Conner
Shopify Partner
52 2 12

Ryan,

Thank you for the response.

Will inventory_quantity remain as a field within Variants-- just as read-only? Or should I expect to get all inventory information from the Inventory API going forward?

Thanks!

Ryan
Shopify Staff
Shopify Staff
499 42 120

Yes inventory_quantity will remain on product variant as a read-only property.  It will reflect the sum of inventory available at all locations.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

We have finished our move to the new inventory APIs.

We followed the documented upgrade checklist published on the Multi location API page and while the changes worked for most of our customers, these badly failing (HTTP 422) for a few other ones (they are super upset at us right now 🙂 )

We have emailed the details of the failure to Shopify support, ticket ID: 9347019

Would you be able to help us on this please?

Thank you in advance,

Ryan
Shopify Staff
Shopify Staff
499 42 120

Tahar,

Took a quick look, the inventory item you are trying to update is assigned to a fulfillment service for managing it's inventory.  When an item is set to use a fulfillment service, only that FS can update the inventory.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

This is a major breaking change - we have many customers relying on us to update their inventory whome we will no longer be able to support 😞

It is said in the documentation that setting inventory for an item managed by a fulfillement service should work fine as long as Shopify is instructed to disconnect if necessary. 

Again, this is major breaking change for us from a finantial perspective as we need to let go of all customers relying on fulfillment services. It is also a major breaking change for our customers as they need to find other ways of managing their inventory before July 1st.

Can you please double check this and get back to us so we can plan accordingly?  

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

I'm not really sure what actions you are trying to do here, is this a fulfillment service you have created and you are trying to manage the inventory?  Or is this a pre-existing fulfillment service that you do not manage?

EDIT: You are also including both relocate_if_necessary and disconnect_if_necessary in your call, these properties are for different endpoints, depending on what you are trying to do, one of these is incorrect.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

We are an inventory management app (we are not a fulfillement service) - most of our customers own two to six stores all using the same inventory. Our app keeps the inventory of all stores in sync at all times. The issue reported above is from one of our customers for whome we are failing to keep his stores in sync as we get 422 errors whenever we try to update the stock levels. 

EDIT: You are also including both relocate_if_necessary and disconnect_if_necessary in your call, these properties are for different endpoints, depending on what you are trying to do, one of these is incorrect.

 

We are trying to set the available inventory at a given location, which flag should we use? 

Ryan
Shopify Staff
Shopify Staff
499 42 120

See above edit, if you are just setting inventory with POST /admin/inventory_levels/set.json then you shouldn't include relocate_if_necessary as that is only for POST /admin/inventory_levels/connect.json as per the documentation.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

See above edit, if you are just setting inventory with POST /admin/inventory_levels/set.json then you shouldn't include relocate_if_necessary as that is only for POST /admin/inventory_levels/connect.json as per the documentation.

We tried this and we are still getting 422 errors. Probably because the stock level at that location can only be changed by the fulfillement service it is tied to? 

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

You also need to specify the location of the fulfillment service as the location_id.  If you can't get that to work, send a copy of your X-Request-Id header in with the ticket and I'll make sure it's looked at.  

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

Sorry for the late reply. 

You also need to specify the location of the fulfillment service as the location_id.

Yes, we do send the location ID as part of the inventory level payload. 
An important point I forgot to mention is that this works just fine for other stores with fulfillement services attached so we can definitely update stock level of product variants attached to third party fulfillement services. It is just the one (and few other stores from other customers) reported in the ticket which is failing for obscure reasons. 

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

Thanks Tahar, this seems like it would be best continued through your support ticket.  It's been escalated to technical support who can look into the specifics of the store and why it may not be working.  As much information as you can add to the ticket will help them greatly.

 

Cheers!

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JAS_Technology
Shopify Expert
84 0 52

Hi again. I'm just looking for a confirmation on something. We will still be able to create a variant with a SKU correct? Updating it requires the inventory_item endpoint but we can create a product_variant with a SKU populated in one call still?

Happy to hear about your crazy ideas.
Ryan
Shopify Staff
Shopify Staff
499 42 120

Current implementation allows the creation or editing of SKU on both the product variant AND the inventory item.  Upon updating either of them, shopify will update the other to match, so they will be in sync.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JAS_Technology
Shopify Expert
84 0 52

By "current implementation" you mean right now, however on July 1st this will no longer be the case? The docs here say:

Happy to hear about your crazy ideas.
Loren_D1
Shopify Partner
9 0 2

Will there be a 'count' endpoint for the inventory_levels?  The GET /admin/inventory_levels.json has 'page' and 'limit' properties, but they aren't very useful if I don't know the 'count' of items.

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

By "current implementation" you mean right now, however on July 1st this will no longer be the case? The docs here say:

We haven't yet removed the ability to set SKU on product creation using the REST API.  And this is not planned to be removed on July 1st, but I wouldn't consider it a permanent solution.

You could however, set SKU on product creation using the GraphQL Admin API (and update it's inventory in the same call), quick example below, working on a more detailed post about it;

 

mutation {
  productCreate(input: {title: "Test Product", variants: [
    {
      inventoryQuantities: 
      [
        {locationId: "gid://shopify/Location/13968900152", availableQuantity: 5},
        {locationId: "gid://shopify/Location/13969457208", availableQuantity: 10}
      ],
      inventoryManagement: SHOPIFY,
      sku: "TestSKU"
    }
  ]})
  {
  product{
    id
    variants(first:10) {
      edges{
        node{
          id
          sku
          inventoryItem{
            id
            inventoryLevels(first:10){
              edges {
                node
                {
                  id
                  available
                  location{
                    name
                    id
                  }
                }
              }
            }
          }
        }
      }
    }
  }
	userErrors {
      field
      message
  }
  }
}

 

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JAS_Technology
Shopify Expert
84 0 52

How about **updating** SKU using Rest API on the product_variant endpoint? Will that be supported after July 1st?

Happy to hear about your crazy ideas.
Ryan
Shopify Staff
Shopify Staff
499 42 120

Will there be a 'count' endpoint for the inventory_levels?  The GET /admin/inventory_levels.json has 'page' and 'limit' properties, but they aren't very useful if I don't know the 'count' of items.

There are no plans for a count endpoint

How about **updating** SKU using Rest API on the product_variant endpoint? Will that be supported after July 1st?

Writing the sku field whether it is updating or initially setting it, will not be removed on July 1st.  You can however consider it deprecated, as we've released the "new and better" way to handle it.

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JAS_Technology
Shopify Expert
84 0 52

Ok thanks. Ryan, I really appreciate all the answers/guidance here. I think I can speak for all developers when I say this change is really rough and we are just trying to get our apps into a state where they won't break. We can then work on optimizing them further to use latest/greatest techniques to make them as efficient as possible.

Happy to hear about your crazy ideas.
Ryan
Shopify Staff
Shopify Staff
499 42 120

No problem Jonathan!  We fully realize that this is tough, it is easily the largest change Shopify has ever made to our APIs so we are right here with you to help the transition!

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Naren1
Shopify Partner
44 0 33

Ryan

inventory_quantity on Variant API docs shows as deprecated. See attached screenshot

1. Can you confirm that "reading" inventory_quantity via Variant API is NOT deprecated?

2. Please clarify whether there are any plans to deprecate "reading" inventory_quantity via Variant API and the deprecation timeline in that case. 

If the API documentation can be updated to make this clear it would clear the confusion.

Thanks!

 

 

ClementG
Shopify Partner
660 0 148

Will read_inventory and read_locations be backfilled for existing installations that already have the read_product scope?

Ryan
Shopify Staff
Shopify Staff
499 42 120

1. Can you confirm that "reading" inventory_quantity via Variant API is NOTdeprecated?

2. Please clarify whether there are any plans to deprecate "reading" inventory_quantity via Variant API and the deprecation timeline in that case. 

On the variant, inventory_quantity is being moved to read-only and there is no plan to remove that functionality.  This should only be used if you want an aggregate count of inventory at all locations, as it will not provide location specific details.

Will read_inventory and read_locations be backfilled for existing installations that already have the read_product scope?

We are handling these requests at deprecations@shopify.com.  If you would like us to backfill any permissions required for multi-location support to your existing installs, email us with the app details, and the permissions you want applied.  We'll confirm the details and respond before the backfill goes out so you know the date.

 

Ryan

 

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

ClementG
Shopify Partner
660 0 148

Ok, thanks Ryan.

Loren_D1
Shopify Partner
9 0 2

Ryan, can you provide an example of using the GraphQL to retreive all of the available inventory for a given product?  I'm trying to get the available quantity for all of the variants associated with a given product, and can't find the correct syntax to query this.  The query below works for just the Product, but I need to get all of the variant inventories below that level. 

query {
  product(id: "gid://shopify/Product/94810538000") {
   variants {
    inventoryItems {
     inventoryLevels (first:10) {
        edges {
          node {
            location {
              name
                     }
           available
               }
              }
                                }
                   }
                   }
  }
  }

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

Hi Loren, you're looking for something like this, +/- the info you need or don't need 

{
  product(id: "gid://shopify/Product/94810538000") {
    id
    variants (first:10) {
      edges {
        node {
          id
          inventoryItem {
            id
            inventoryLevels (first:6) {
              edges {
                node {
                  id
                  available
                  location {
                    id
                    name
                    address {
                      address1
                      address2
                      city
                      country
                      zip
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

 

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Loren_D1
Shopify Partner
9 0 2

Thanks - that works perfectly.  But how'd you generate that so fast?

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

Practice!

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Mark_Lau
Shopify Partner
4 0 0

Hi Ryan,

For the fulfillment service API, how will i know which location_id i need to use for each line item? 

Right now my company uses a private app to do all our fulfillments and we have about 600 different fufillment service. 

Some of our order's come with a origin_location attached with the line item but some order's do not have it. how will i be able to fufill the line item if it does not come with an origin_location?

thanks.

PriceMole_Kevin
Tourist
7 0 1

Hi Ryan,

Do we need access to the locations API if we are just setting the inventory levels?  I'm trying to figure out how to query the levels and set their quantities but I'm a bit confused by the guide.

Do we need a location_id and an inventory Item id to adjust an inventory level?

Thanks

Ryan
Shopify Staff
Shopify Staff
499 42 120

Hi Ryan,

For the fulfillment service API, how will i know which location_id i need to use for each line item? 

Right now my company uses a private app to do all our fulfillments and we have about 600 different fufillment service. 

Some of our order's come with a origin_location attached with the line item but some order's do not have it. how will i be able to fufill the line item if it does not come with an origin_location?

thanks.

Hi Mark, what is the use case behind 600 fulfillment services? 

When an item is assigned to a fulfillment service, an order will contain a property for `fulfillment_service` with the name of the fulfillment service responsible for that line item.  All fulfillment services have a ` location_id` assigned to them, which is what you should use.

Do we need access to the locations API if we are just setting the inventory levels?  I'm trying to figure out how to query the levels and set their quantities but I'm a bit confused by the guide.

Do we need a location_id and an inventory Item id to adjust an inventory level?

Thanks

If you want to query the `locations.json` endpoint you will need the read_locations.  For some more examples and details check out the migration guide for inventory and fulfillment

Ryan | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog