API call to update inventory policy

Solved
clemoyne
New Member
2 1 1

For years we have used an API call to update inventory policy to continue or deny overselling of particular variants based on certain criteria.

The latest API changes appear to have broken this, and I get this error message:

"Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API."

Here is how we used to do it in Python:

variant = shopify.Variant.find(variant_id)
variant.inventory_policy = policy
variant.save()

I cannot for the life of me figure out how to do this in the new API scheme, and the documentation is not clear.  Any help would be most appreciated!

0 Likes
clemoyne
New Member
2 1 1

This is an accepted solution.

I figured out the problem...turns out I had to update the version of PythonAPI that we were using.  Problem solved!