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)
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 32

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 144

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 144
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

PriceMole_Kevin
Tourist
7 0 1

Hi Ryan,

Thanks for the response, Im assuming you need to query locations to update an inventory level since 
https://help.shopify.com/api/reference/inventory/inventorylevel#adjust takes an inventory_item_id and a location_id? 

We don't really need to do anything with locations at all, but I don't see how we adjust inventory levels without it.

Thanks

Ryan
Shopify Staff
Shopify Staff
499 42 120

For your use-case you will need 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

Radhesh_V_
Shopify Partner
5 0 0

Hello,

I want to adjust multiple inventory_levels (around 300-400) in single GraphQL mutation query call, is there a way to do so? I tried adjusting 400 inventory levels using GraphQL App, but it showed " TypeError: NetworkError when attempting to fetch resource. " error to me. Is this error due to adjusting large number inventory levels at a time or weather am i missing something.

Thanks in advance.

Ryan
Shopify Staff
Shopify Staff
499 42 120

New blog post How the New GraphQL Admin API Can Help You Manage Inventory and Locations.

 

 

I want to adjust multiple inventory_levels (around 300-400) in single GraphQL mutation query call, is there a way to do so? I tried adjusting 400 inventory levels using GraphQL App, but it showed " TypeError: NetworkError when attempting to fetch resource. " error to me. Is this error due to adjusting large number inventory levels at a time or weather am i missing something.

 

Radesh, you will want to look into how the call limit works for GraphQL.  That mutation would be too large.  I think the limit would be 200 inventoryAdjustQuantity mutations at one time.

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

Hari2
Shopify Partner
6 0 1

Hi Ryan,

We are using a Private app to update the inventory levels from our warehouse using Inventory set.json API. We noticed that once we update the inventory using the seet.json API, "Fulfillment service" value for the Product/variant changes to the Fulfillment service associated with the location_id.

Is this expected ? 

We are using Fulfillment service = Manual right now for all the products and we update inventory quantity only for certain products. 

 

Thanks,

Hari

 

Ryan
Shopify Staff
Shopify Staff
499 42 120

Hi Hari,

Is the location_id you are passing in the inventory_levels set, the location_id of a fulfillment service? If so then yes this is intended.  This is because you are adding stock to that fulfillment service 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

Hari2
Shopify Partner
6 0 1

Yes Ryan. location id is tied to a fulfillment service.

Can we use any a location id that is not tied to a fulfillment service for inventory SET ?

Will Fulfillment service stay as Manual in this case ?

Also, for some the SKUs we are receiving 403 forbidden though all the information are accurate.

Ryan
Shopify Staff
Shopify Staff
499 42 120

I believe setting inventory to be stocked at a fulfillment service location, means that inventory is now fulfilled by that location which is why you are seeing it change.  Setting inventory to a location that is not a fulfillment service will not change the fulfillment service off of manual.

For the SKU issue, its probably if the item is stocked at a fulfillment service already, in that case you have to include disconnect_if_true, to remove it from it's current location and connect it to the location specified in your call.

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