Solved

Setting inventory_management broken

fulfill_engine
Shopify Partner
4 1 2

Setting the inventory_management field through the API does not work if the variant is connected to a Fulfillment Service app location.  The value remains what it was before.  Trying to set the value to "shopify" and it remains null, or vice versa.

 

You can click the "track quantity" button in the UI to set this field, but setting through the API is ignored.

 

If the product is tied only to a regular shopify location (not affiliated with a Fulfillment Service app), then setting through the API works. But once tied to a Fulfillment Service app location (and possibly regular locations in addition), then the update  is no longer honored.

Can anyone at Shopify help with this?

Accepted Solution (1)
fulfill_engine
Shopify Partner
4 1 2

This is an accepted solution.

After some digging through the GraphQL API as an alternative, I see that that API documents that the InventoryManagement property is being deprecated and to use the "tracked" property on the InventoryItem instead.

So instead, I was able to do a PUT to the InventoryItem and adjust the tracked property, which did work for me.

View solution in original post

Replies 3 (3)

RobZone
Shopify Staff
70 10 22

Hi @fulfill_engine 

 

Are you trying to modify the variant inventory configuration using the same api client id as the fulfillment service app?  It would help to have a detailed log of the REST requests and responses, after removing the credentials of course.  

To learn more visit the Shopify Help Center or the Community Blog.

fulfill_engine
Shopify Partner
4 1 2

Hey @RobZone,

 

I've tried with both the same API client as the fulfillment service app and I've tried with a different client, to see if that was somehow the cause.


Here is an example request:

PUT https://*********.myshopify.com/admin/api/2023-01/variants/44140965855396.json HTTP/1.1
X-Shopify-Access-Token: *********
Content-Type: application/json
User-Agent: PostmanRuntime/7.31.1
Accept: */*
Cache-Control: no-cache
Host: *********.myshopify.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 88

{
    "variant":
        {
            "inventory_management":"shopify"
        }
}


Here is the response received:

HTTP/1.1 200 OK
Date: Fri, 24 Feb 2023 00:52:48 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
Location: https://********.myshopify.com/admin/products/8104291795108/variants/44140965855396
Server: cloudflare
Content-Length: 753

{"variant":{"id":44140965855396,"product_id":8104291795108,"title":"Apple Green \/ XS","price":"10.00","sku":"SAMPLE_SKU","position":2,"inventory_policy":"deny","compare_at_price":null,"fulfillment_service":"manual","inventory_management":null,"option1":"Apple Green","option2":"XS","option3":null,"created_at":"2023-01-18T12:21:20-05:00","updated_at":"2023-02-15T09:54:33-05:00","taxable":true,"barcode":null,"grams":0,"image_id":42338861187236,"weight":0.0,"weight_unit":"lb","inventory_item_id":45988815306916,"inventory_quantity":0,"old_inventory_quantity":0,"requires_shipping":true,"admin_graphql_api_id":"gid:\/\/shopify\/ProductVariant\/44140965855396"}}


Calling the GET Variant endpoint also shows "inventory_management":null.   If I click the "Track quantity" checkbox in the UI, then the value of inventory_management becomes shopify on the GET endpoint, and I have the reverse issue where trying to set it to null through the PUT no longer works.

Lastly, if I disconnect the variant from my fulfillment service app location, then I am able to toggle this value through the API call above.


 

fulfill_engine
Shopify Partner
4 1 2

This is an accepted solution.

After some digging through the GraphQL API as an alternative, I see that that API documents that the InventoryManagement property is being deprecated and to use the "tracked" property on the InventoryItem instead.

So instead, I was able to do a PUT to the InventoryItem and adjust the tracked property, which did work for me.