Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
After the last update, all my workflows started experiencing problems. Eg.
This code was working perfectly, and now has a message "productIdsArray" is invalid. Replace this variable.
{% assign validIds = "" %}
{% assign id = getProductDataForeachitem.vendorCollectionMetaobject.value.brandOwnedBy.referenceProductMetaobject.system.id %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% assign validIds = id %}
{% endif %}
{% for peopleValues_item in getProductDataForeachitem.vendorCollectionMetaobject.value.peopleValues %}
{% assign id = peopleValues_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}
{% for planetValues_item in getProductDataForeachitem.vendorCollectionMetaobject.value.planetValues %}
{% assign id = planetValues_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}
{% for productSustainability_item in getProductDataForeachitem.vendorCollectionMetaobject.value.productSustainability %}
{% assign id = productSustainability_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}
{% for productManufacture_item in getProductDataForeachitem.vendorCollectionMetaobject.value.productManufacture %}
{% assign id = productManufacture_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}
{% assign id = getProductDataForeachitem.vendorCollectionMetaobject.value.productChemicals.referenceProductMetaobject.system.id %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% for productBlends_item in getProductDataForeachitem.vendorCollectionMetaobject.value.productBlends %}
{% assign id = productBlends_item.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% endfor %}
{% assign id = getProductDataForeachitem.vendorCollectionMetaobject.value.productContent100.referenceProductMetaobject.system.id | strip %}
{% if id and id contains "gid://shopify/Metaobject/" %}
{% if validIds == "" %}
{% assign validIds = id %}
{% else %}
{% assign validIds = validIds | append: "," | append: id %}
{% endif %}
{% endif %}
{% assign productIdsArray = validIds | split: "," %}
{% if productIdsArray == blank %}
{% assign productIdsArray = "[]" %}
{% endif %}
{
"metafields": [
{
"ownerId": "{{getProductDataForeachitem.id}}",
"namespace": "custom",
"key": "all_product_values",
"value": "{{ productIdsArray | json }}",
"type": "list.metaobject_reference"
},
{
"ownerId": "{{getProductDataForeachitem.id}}",
"namespace": "custom",
"key": "inherited_metafields_check",
"value": "TRUE",
"type": "boolean"
}
]
}
Solved! Go to the solution
This is an accepted solution.
This was caused by a bug in how Flow interprets Liquid (specifically `assign`) that has since been resolved. Please let us know if you experience this issue again.
Hello HelenaBee,
I am experiencing similar issues and did not find a solution yet. My flows include a piece of liquid code that ran fine for months, and started to give errors recently. I cannot save the flow anymore without solving this issue, but I don't know how to fix it.
It looks like the {% assign %} tag combined with a date variable is causing issues, as code that does not have that combination seems to be unaffected. My liquid code:
{
"phoneNumber": "{{getOrderDataForeachitem.customer.phone}}",
"data":
{
"firstName": "{{ getOrderDataForeachitem.customer.firstName|default:' ' }}",
"taal": "{{getOrderDataForeachitem.customer.locale | slice: 0, 2 }}",
"orderId": "http://mijnkast.mublio.nl/orders/{{getOrderDataForeachitem.id | split: '/' | last }}",
"installatieDatum": "{{ getOrderDataForeachitem.installatie.value | date: '%e/%m/%Y' }}",
"installatieTijdvakStart": "{% assign travelTimeInS = getOrderDataForeachitem.reistijd.value | date: '%s' %}{% assign travelTimeInSHalf = travelTimeInS | divided_by: 1800 %}{% assign travelTimeInSHalfRound = travelTimeInSHalf | ceil | times: 0.5 | times: 60 | times: 60 %}{% assign startInS = getOrderDataForeachitem.installatie.value | date: '%s' %}{{ startInS | plus: travelTimeInSHalfRound | plus: 7200 | round | date: '%k:%M' }}",
"installatieTijdvakEind": "{{ startInS | plus: travelTimeInSHalfRound | plus: 7200 | plus: 7200 | round | date: '%k:%M' }}",
"installatieReistijd": "{{ getOrderDataForeachitem.reistijd.value | date: '%s' | plus: 7200 | date: '%k:%M' }}",
"installatieTijd": "{{getOrderDataForeachitem.installatieTijd.value | round | plus: 1 }}",
"installatieMinVier": "{% assign installatieMinVier = getOrderDataForeachitem.installatie.value | date: '%s' %}{{ installatieMinVier | minus: 2419200 | date: '%e/%m' }}"
}
}
Error message: "installatieMinVier" is invalid. Replace this variable.
I have many other flows with this issue, I can send examples.
@paul_n Do you have a clue what's going on here?
Kind regards,
Koen
This was caused by a bug in how Flow interprets Liquid (specifically `assign`) that has since been resolved. Please let us know if you experience this issue again.
This is an accepted solution.
This was caused by a bug in how Flow interprets Liquid (specifically `assign`) that has since been resolved. Please let us know if you experience this issue again.
Confirmed, the code now works again. Thanks!
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025