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

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
497 42 117

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
80 0 47

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
497 42 117

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
497 42 117

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
497 42 117

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
80 0 47

Hey Paul,

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

Happy to hear about your crazy ideas.
Zapfor_Apps
Shopify Partner
83 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 - Add costs and track profit (https://apps.shopify.com/simplycost)
Ryan
Shopify Staff
Shopify Staff
497 42 117

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
497 42 117

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
Explorer
50 1 9

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
497 42 117

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
497 42 117

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