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

Ryan
Shopify Staff
Shopify Staff
497 42 117

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)
Ryan
Shopify Staff
Shopify Staff
497 42 117

Robert, I'm looking for an answer on this as well. Did you learn anything new? My store is also not multi location enabled, and I fulfill manually.

 

Could someone please answer Robert and Hari's questions about private apps that fulfill manually and don't have multi location enabled? Does this change coming up on 7/1 still apply in those cases? I did find a location ID on our only fulfillment location and I tested this by adding a location_id to my request to the fulfillment API and it came back as "NotFound", presumably because the location_id field on our orders is set to NULL.

Hi Ben,

No I haven't got an answer yet, though Ryan did reply - I still have no idea what I should be setting the location_id to of the requests that I make. I have no fulfillment locations, so I have no IDs...!

Ben & Robert - I'm also using a private app with no fulfillment services.  For my fulfillments, I'm using the Primary_Location_ID from the /admin/shop.json.  I can query the locations (/admin/locations.json) and confirm that the locations exists.

Some clarifications on this thread:

  • Yes Private apps will have to move to the new fulfillment API behaviours, these requirements are independent of multi-location being enabled. 
  • If you are creating a fulfillment using the API, you must include a location_id.  All shops will have at least one location and therefore a location_id.
  • Having multi-location enabled just allows merchants to create more than one location.

Whether you want to support merchants with multiple locations is up to you, and would have to be reflected in your app if you do.

 

Hi Ryan,

My name is Bindu. I am new here.

I believe someone from the team answered your support ticket already, there's a syntax error in the JSON you are sending!

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

Ben106
Tourist
36 0 3

Thank you for the reply, Ryan. So what should I do to ensure our orders will return a value in the location_id field? I presume that's the reason fulfilling orders using the API is returning a "NotFound" status code, since no orders have the location ID I'm sending in. 

EDIT: I found my issue. We have two Shopify stores, one designated as a "test" store. I was using the production location_id for the test store. I plugged in the correct ID and the fulfillment is working now.

Ben

Robert_Tolton1
Tourist
9 0 1

I'm still not sure - the only locations that the locations endpoint gives me are for POS iPad locations, neither of which I can use as the location_id of fulfillments?

Where can I get a location_id that will work? The primary_location_id of the shop?

Ben106
Tourist
36 0 3

Hey Robert -

Did you query the shop.json endpoint? it would be [your store]/admin/shop.json.

Robert_Tolton1
Tourist
9 0 1

Hi Ben, indeed - that's where I can get the primary_location_id value from, is that what I should be using?

Ryan
Shopify Staff
Shopify Staff
497 42 117

So what should I do to ensure our orders will return a value in the location_id field?

Hey Ben, orders only have a location_id if it is made from a POS location.

I'm still not sure - the only locations that the locations endpoint gives me are for POS iPad locations, neither of which I can use as the location_id of fulfillments?

Where can I get a location_id that will work? The primary_location_id of the shop?

The primary_location_id will correspond to the shipping origin location which should work.  There is also no reason why a POS iPad location wouldn't work.  There is no distinction between a POS location and a manually created location.  Adding a location_id to a fulfillment is simply stating which physical location the product is being shipped from.  If that location is the same as a store with a POS, then use that location_id.  If it is a separate location (warehouse, etc) add a new location in the admin with that address, and use that location_id.

 

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

Ben106
Tourist
36 0 3

The primary_location_id is what I used, yep. It seems to be working with my fulfillments in my "test" Shopify environment.

Robert_Tolton1
Tourist
9 0 1
Ryan
Shopify Staff
Shopify Staff
497 42 117

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

 

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

Adam54
New Member
2 0 0

Now that we have to do multiple calls to the API to update something simple like QTY information (example, create a product, then update inventory qty with a second call), is it possible using REST or GraphQL to do both in one call? I have a client that has multiple shops and in their case this will result in a minimum of 8 calls to update the same stock across all stores. Please let us know or an example. Thanks

Primaseller
New Member
2 0 1

Hey Ryan

We noticed that the Sale Order Items structure of your API has a Variant ID but no reference an Inventory Item ID. This makes is extremely complex for us to map products for our sellers leading them to miss orders if they haven't synced their catalog correctly. Particularly because there is no search API available to get the inventory item ID given a variant ID.

Are you planning to introduce inventory_item_id in the sale order item get structure? If not, please do so - this is really critical for our functionality needs. 

Ryan
Shopify Staff
Shopify Staff
497 42 117

Hey Adam,

GraphQL can definitely do this.  I actually wrote this blog post as a primer to developers looking to use GraphQL to manage 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

rplum
Shopify Partner
18 0 7

Ryan,

I need some clarification on creating products with the new structure from teh inventory levels additions.

We are currently creating products using teh REST api calls.   It appears that we will have to first create the variations and get the inventory item ID before we can assign a sku, then attach the item to a location before we can set the inventory level. 

I see your blog post regarding using GQL to do this in one step, but I envision my final solution to use a combination of REST and QGL calls, and I'm not seeing any way to get teh pure IDs via QGL.   teh QGL id s seem to derive from the IDs   eg.

gid://shopify/ProductVariant/9002157375551
9002157375551  REST Variant ID

but can I count on this?  I see to recall reading somehwere that we shoudl NOT count on this. 

This has become more urgent today since a new store I tried to create products in gave me this error:

{"error":"Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API."}

I thought we had until Aug 1 to resolve this.  I don't see this error on any other of our clients stores.

Take care,

Roy.

 

 

 

 

Ryan
Shopify Staff
Shopify Staff
497 42 117

Hi Roy,

Looks like you have a few different questions...

It appears that we will have to first create the variations and get the inventory item ID before we can assign a sku, then attach the item to a location before we can set the inventory level. 

You can still create products that have a SKU in REST.  Variants will automatically be assigned to a location upon being created.

I see your blog post regarding using GQL to do this in one step, but I envision my final solution to use a combination of REST and QGL calls, and I'm not seeing any way to get teh pure IDs via QGL.   teh QGL id s seem to derive from the IDs   eg.

gid://shopify/ProductVariant/9002157375551
9002157375551  REST Variant ID

but can I count on this?  I see to recall reading somehwere that we shoudl NOT count on this. 

I don't know what you mean as pure IDs.  You should not try to infer the graphQL ID from the REST ID.  This will not always match.  You can retrieve the ID from either the REST of GraphQL API.  Do not count on the ID being the same.

This has become more urgent today since a new store I tried to create products in gave me this error:

{"error":"Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API."}

I thought we had until Aug 1 to resolve this.  I don't see this error on any other of our clients stores.

New apps cannot make adjustments after July 1st.  Existing apps have until Aug 1.

 

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

rplum
Shopify Partner
18 0 7

Ryan,

Thanks for your quick reply

re:  New apps cannot make adjustments after July 1st.  Existing apps have until Aug 1

So this means that we cannot add any new clients of our app until we have completed this conversion.

That's harsh.

re:

I don't know what you mean as pure IDs.  You should not try to infer the graphQL ID from the REST ID.  This will not always match.  You can retrieve the ID from either the REST of GraphQL API.  Do not count on the ID being the same.

The ID I refer to is the number only that I need to access the item via REST.  Currently the only way I can get both the ID  (call it the old ID or the REST ID )   and the GQL ID is via REST.   So if I end up creating products viat GQL, I will ber missing teh REST ID's,  which I will need to get and fill in.

take care,

Roy.

Ryan
Shopify Staff
Shopify Staff
497 42 117

So this means that we cannot add any new clients of our app until we have completed this conversion.

That's harsh.

New clients can install an existing app still.  You would be able to use your current behaviour until Aug 1.

The ID I refer to is the number only that I need to access the item via REST.  Currently the only way I can get both the ID  (call it the old ID or the REST ID )   and the GQL ID is via REST.   So if I end up creating products viat GQL, I will ber missing teh REST ID's,  which I will need to get and fill in.

Ah.  Yes the only way to get the GraphQL ID and the REST ID in the same call is using the REST API.

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

rplum
Shopify Partner
18 0 7

Ryan,

We are a private app, and we are getting the aforementioned error now when trying to create products, so what you have said regarding existing behavior is not true at least for this particular new client's store.  It woudl appear that we are closed off from selling to new clients until I can get this working.

I am frantically tryiing to create products on a dev site using GQL, but I am stuck on creating variants with option values.  I dont seem to be able to fanthom how the docs on the various objects translate to queries or mutations.  

I am using the GraphQL app on the my dev store to try to work out what queries and mutations I will need.  I have created products and assigned inventory.  I am currently stuck on creating the option names at the product level and option values at the variant level.

Any help is greatly apreciated !!

 

Take care,

Roy.

 

rplum
Shopify Partner
18 0 7

Ryan,

succesfully written GQL mutatiosnto create my products.  Now I "just" need to encode that method into my app.

I would also like to say that it appears there is no way to directly set an inventory level to a specfic qty using GQL.   Tt appears that this can only be done using the REST end point 

/admin/inventory_levels/set.json

am I missing something?

Take care,

Roy.

rplum
Shopify Partner
18 0 7

Ryan,

It appears that the REST api is not working for updating inventory levels.

GET requests are working fine, but POST requests like 

/admin/inventory_levels/adjust.json

or 

/admin/inventory_levels/set.json

return an html response instead of a json response.

I also tried PUT which is how the varient endpoint work to make changes, in case the docs are wrong, but that got me a 406 unacceptable response.

This leaves me kind of dead in the water.

take care

Roy.

 

Ryan
Shopify Staff
Shopify Staff
497 42 117

We are a private app, and we are getting the aforementioned error now when trying to create products, so what you have said regarding existing behavior is not true at least for this particular new client's store.  It woudl appear that we are closed off from selling to new clients until I can get this working.

New private apps will not be able to use the old behaviours.

 I would also like to say that it appears there is no way to directly set an inventory level to a specfic qty using GQL.   Tt appears that this can only be done using the REST end point 

If I recall correctly in GraphQL inventory level only has an adjust mutation, not a set.  So I don't think you are missing anything here.  You could do the math on your end.

GET requests are working fine, but POST requests like 

/admin/inventory_levels/adjust.json or /admin/inventory_levels/set.json

return an html response instead of a json response.

Can you show an example?  Make sure you aren't sending any cookies.  If the HTML response is a login page its due to the cookies.

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