How can I update tracked quantity using Python API?

1 0 0


How can I update to true tracked quantitry in python api? 
I use this for update quantity 

shopify.InventoryLevel.set(inventory_item_id=variant.inventory_item_id, location_id=<loc id>, available=<available>)

But this only works if enabled tracked quantitry. Otherwise I get an error 422

Response(code=422, body="b'{"errors":["Inventory item does not have inventory tracking enabled"]}'"


Reply 1 (1)

10 3 3

When creating new product, there is optional settings called "inventory_management" (possible values are: 'null' or 'shopify')

You will be able to update your inventory levels only in case "inventory_management"="shopify" for related product.

You can use following json code to update inventory_management for necessary product:


use PUT for related product_id on


"id": "7815459321185",
"variants": [{
"id": "43467836236481",
"inventory_management": "shopify"