First of all, you need to ask the store owner for approval for the write_inventory scope. Currently, you can probably only read values, and the request is being blocked.
Regarding triggering it on a specific product, I think you can only trigger the flow when a product is added or its quantity changes. Even if you could use a webhook to trigger it, it would be triggered every time the product status changes.
So, use your implementation but add a filter inside the flow to run only if the product handle or ID matches the selected product.
If you need further assistance or additional changes, feel free to ask!
And if you want to set this flow to particular product. Put a tag on the products. And then you can add a condition in the flow, if the product has the tag, then go to the set inventory action.
Thank you for explaining thoroughly about the HTTP request and the trigger flow. I was able to make it work! I should just have ticked the write_inventory scope.
Now, I just need to figure out how should the body be written as I am going to be specific to 9 products only which will be launched tonight (since it is not ideal that other products’ inventory quantity be affected).
How can I find the “inventory_item_id” to change it for each product? Or should I add another condition?
Use your implementation, but add if statements for specific products before it. Then, you can use a dynamic variable for the product/variant ID reference e.g. {{productVariant.id}}. Try different ways and pick the best one.
FYI, Flow now has a Send Admin API request action that handles scopes, API key, etc for you. Highly recommend using that in the future as it’s way easier.
Quick question for a similar situation… I need to (trigger) detect when variant inventory is updated, then (condition) if the variant’s inventory is < 3, (action) I need to update the variant’s inventory to 0.
I get how to do the trigger/conditional pieces in Flow. Might you be able to provide some guidance re: what the Http Request would look like? Thanks.
One note - be careful that you don’t create an infinite loop by running on inventory updated and then update inventory. You should check both the before and after quantity to prevent it from calling the action repeatedly.