I’ve been having an issue with products being pushed from another piece of software not setting inventory to be tracked and enabling the continue selling when out of stock option. This has caused a few orders to be placed that we cannot fulfill. Most times we offer a replacement item of equal or higher value but would rather not have this issue in the first place.
So I wanted to create a flow that as soon as a product is created that it applies inventory tracking and deny selling product that is out of stock.
I’m stuck,
Trigger is Product Creation →
Action of Get Product Data →
Action of For Each Loop - product.variants →
Action of Send API Request (productVariantUpdate)
And this code that isn’t working
{
“productId”: “{{ product.id }}”,
“variants”: [
{% for variants_item in product.variants %}
{
“id”: “{{ variants_item.id }}”,
“inventoryPolicy”: “DENY”
“allowPartialUpdates”: true}
“inventoryItem”: {
“tracked”: true,
}{% if forloop.last == false %},{% endif %}
{% endfor %}
],
}
I get an exception error but no other information.
Any help would be greatly appreciated!!