I have a question about how to obtain a list of location IDs in Shopify Flow. I want to update inventory quantities based on specific conditions. Since I have six locations and may have more in the future, obtaining a list of all location IDs would be the best solution. However, I haven’t been able to find a useful variable to obtain the location ID list in Shopify Flow.
My question is like this, is there a useful variable for getting the locations in flow ?
{% for variants_item in product.variants %}
{
"location_id":828XXXXXXX, // I don't want to use hard coding here, and the locations will increase in future.
"inventory_item_id:{{variants_item.inventoryItem.variant.inventoryItem.legacyResourceId}},
"available":0
}
{% endfor %}
Thanks, knowing the trigger helps because sometimes they have a specific variant. In this case it doesn’t. This is how I would output the ID for the REST API.
{% for variants_item in product.variants %}
{% for inventoryLevels_item in variants_item.inventoryItem.inventoryLevels %}
{{inventoryLevels_item.location.legacyResourceId}}
{% endfor %}
{% endfor %}
That said, I’m not sure how you will do this for multiple inventory updates in one API call and this loop won’t generate multiple API calls for you. See https://community.shopify.com/topic/1507852
Thank you very much. I understand that it is not possible to make multiple API calls.
I’m not sure how you will do this for multiple inventory updates in one API call and this loop won’t generate multiple API calls for you. See https://community.shopify.com/topic/1507852