Low stock under 3 Products Set to Zero with multiple locations - Flow Automation

gilbertsohal
Shopify Partner
2 0 2

I have multiple locations where I need to set the inventory of each product variant to 0 if the current inventory is 2 or less.

If there was an action feature to update stock quantity in Shopify Flow, this would solve my problem. I can set the logic as:

 

Trigger: Inventory Quantity Changed

gilbertsohal_1-1710810743458.png

 

Then: Check if inventory is less than 3

gilbertsohal_2-1710810758356.png

 

Action: Update inventory quantity to 0
Send HTTP Request: 

gilbertsohal_3-1710810782574.png
gilbertsohal_4-1710810796289.png


Complete Flow

gilbertsohal_6-1710810874742.png

 

This flow is functioning correctly for a single location. However, I have multiple locations where I need to set the inventory of each product variant to 0 if the current inventory is 2 or less.

I attempted the following HTTP request, but it did not work:


{
"locations": [
{
"location_id": 84738277671,
"inventory_item_id": "{{productVariant.inventoryItem.legacyResourceId}}",
"available": 0
},
{
"location_id": 84738179367,
"inventory_item_id": "{{productVariant.inventoryItem.legacyResourceId}}",
"available": 0
},
{
"location_id": 93070983463,
"inventory_item_id": "{{productVariant.inventoryItem.legacyResourceId}}",
"available": 0
}
]
}

Reply 1 (1)

paul_n
Shopify Staff
920 127 221

You need a separate request for each of those. 

 

You could probably also loop over the locations for the inventory item and put the location id in via a loop. (Use "for each"). 

But doing that 1x1 is fine.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.