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

Ryan
Shopify Staff
492 42 113

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)
bardia
New Member
15 0 0

Is this a bug or intended and not documented?

When doing `POST /admin/inventory_levels/set.json` if the location_id belongs to a fulfillment_service the endpoint returns 422 without any error message even if you pass `disconnect_if_necessary: true`

Now if you try to circumvent this and do `POST /admin/inventory_levels/connect.json` to the fulfillment_service location_id and the product variant has a blank `SKU` then good luck figuring out the 422 response from the endpoint with an empty body(relocate_if_necessary: true is passed in). I stumbled upon the requirement when trying to set the fulfillment service through the dashboard.

UPDATE: setting the product's fulfillment_service through PUT products/variants/<id.json> actually returns

{
  "errors": {
    "sku": [
      "can't be blank"
    ]
  }
}

 

Can you guys make `POST /admin/inventory_levels/set.json` actually honor the `disconnect_if_necessary: true` so that an application doesn't have to call `connect.json` first.

 

 

 

 

Hari2
Shopify Partner
6 0 1

Hi Ryan,

We are setting disconnect_if_necessary to true for all the set.json calls. Even if that flag set, Shopify is returns 403 or 422 randomly.

We created a new product with some inventory in the screen and inventory levels GET call shows the item is randomly assigned location_id = 1809842203 which doesn't exist when we lookup using GET location calls.

Then when we tried to set the inventory qty using set.json it throws 403 forbidden even when disconnect_if_necessary to true.

Is there any reason why the new product is assigned to a random location_id after creation ?

 

Dennis_Seipel
Shopify Partner
1 0 0

Our POST to Fulfillment have suddenly stopped working with the error "Required parameter missing or invalid".  I addeed location ID (our site doesn't have any defined fulfillment services, but when I call the Get for locations I do get one location and that's the ID I'm using).  

Here's the body I'm sending:

{"fulfillment": {"location_id": 15293071, "tracking_number":"9405510200882755885011","notify_customer": true, "line_items": [ { "id": 1261297664109, "quantity": 1 },{ "id": 1261297696877, "quantity": 1 }]}} 

what's the missing/invalid?

Radhesh_V_
Shopify Partner
5 0 0

Hola Ryan,

I even tried with 200 inventory adjustment but it results the same error. Then I tried with only 14 inventory adjustment, it showed me the same.

But when I tried multiple times with 11 adjustment values, it showed me unreliable results, like, it results proper output while some time shows "TypeError: NetworkError when attempting to fetch resource." error again.

Even there is no issue regarding call cost. Below is the call cost value for 10 adjustment for your reference.

 

 "extensions": {
    "cost": {
      "requestedQueryCost": 50,
      "actualQueryCost": 50,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 950,
        "restoreRate": 50
      }
    }
  }

 

 

Thanks in advance.

Mark_Lau
Shopify Partner
4 0 0

Hi Ryan

Thanks for the advice

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

We have vendor's listing their product on our site and each vendor we assigned a fufillment service so they could revieve emails of when their product was fufilled. We have started to change this model but we still need to support the old products until the end of the year.

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 

 

line_items:[
  {
    ..
    "fulfillment_service": "xihe",
    ..
  }
]

I saw the fufillment service is just a name, so does that mean that i will need to search through the locations based on the name and find the location_id

Robert_Tolton1
Tourist
9 0 1

So, if my shop has "multi_location_enabled" set to false, confirmed by querying the "shop" endpoint - is there any action I need to take? This seems unclear.

From what I understand, for my POST requests to create Fulfillments, I need to add a "location_id" - but the only locations my shop has (found by querying the "locations" endpoint) are Point-Of-Sale iPad locations. (I'm guessing these are meant to be "legacy" locations now, but their "legacy" properties are false).

What should I be setting "location_id" to on my requests..??

-EDIT-

I'm seeing a "primary_location_id" - is this what I should be using? Is this property even mentioned in the documentation anywhere?

Also, the migration guide URL at the top of this page is still broken:
https://help.shopify.com/api/reference/shipping_and_fulfillment/fulfillment#create

Mark_Lau
Shopify Partner
4 0 0

Hi Ryan, 

I am still unsure if my fulfillment service is set to manual, which location_id should i use. I can't seem to find the answer for this in any of the documentation. Not sure is it because i am missing something or am unable to understand.

 

Thanks

ostalks
Shopify Partner
5 0 0

Hi Ryan,

I've done the /admin/inventory_levels/set.json POST through php with json data, and I'm receiving an error message:

{"errors":{"inventory_item_id":"Required parameter missing or invalid"}}

I've sent inventory_item_id in the json string.  I got the inventory_item_id from the product api call in the variants section of the return.

What could be the problem here?

Tahar_from_Stoc
Tourist
12 0 1

Hi Ryan,

First of all, I am sorry to come back to this forum again, you must be drowning in different questions the developper community is bring up every day. 

We have been in touch with a couple of Shopify developpers and they reported an issue on Shopify side which is causing the inventory level updates to either fail with 422 error or reset the product filfillement services to Manual. 

The Shopify developpers confirmed that you guys are looking into these issues. Can you please let us know if the July 1st deprecation deadline will still apply even if these issues aren't fixed? 

Thanks in advance and again, sorry for all the back and forth. 

Tahar

ngt500
New Member
2 0 1

To "ostalks Admin"

I had the same issue. I was sending my JSON POST via php curl.

I was first sending the encoded JSON like this:

{"inventory_levels":{"inventory_item_id":12345678901,"location_id":87654321,"available":100}}

Results: "{"errors":{"inventory_item_id":"Required parameter missing or invalid"}}"

I removed the "inventory_levels" from my request and now it works.

/admin/inventory_levels/set.json

{"inventory_item_id":"12345678901","location_id":"87654321","available":"100"}

I am using "manual" for fulfillment and the location_id is just the shopify store.