Disable "track inventory" with REST API (now that InventoryItem and InventoryLevel exist)?

Using the REST API, I’ve been able to get my product variant to use ‘track inventory’ by setting the variant’s inventory_management to “shopify”, and I’ve been able to set the inventory using the confusing InventoryLevel API.

However, I am unable to perform the equivalent of unchecking the “track quantity” checkbox via the REST API. If I try to set the variant’s inventory_management to “”, the API response indicates that inventory_management is still “shopify”

I figure I need to do something with InventoryItem and/or InventoryLevel, but the documentation for InventoryLevel “DELETE” command suggests that every InventoryItem needs to have at least one InventoryLevel, which I assume means I can’t just delete the applicable InventoryLevel object.

Does anyone know how to do this?

(Usage scenario: removing the sales limit on a product)

1 Like

Ahoy matey!

You need to get the inventory_id for the item and then set the tracked value to false.

Example using cURL:

curl -d '{"inventory_item":{"id":{INVENTORY_ID},"tracked":false}}' \
-X PUT "https://{SHOP_NAME}.myshopify.com/admin/api/2023-01/inventory_items/{INVENTORY_ID}.json" \
-H "X-Shopify-Access-Token: {ACCESS_TOKEN}" \
-H "Content-Type: application/json"

{INVENTORY_ID} is the inventory Id

{ACCESS_TOKEN} is your access token

{SHOP_NAME} is your shop name

1 Like

I had that. Turned out the problem was unrelated: I was trying to use the PUT command to update the variant’s metafields at the same time, and that was blocking the command from working.

Thanks and I’m wondering why I can’t put this option right when I create variants using Rest API. So weird!