Changelog
What’s New at Shopify?
Shopify Flow - Access typed metafields
You can now check metafield values more easily in the Flow app. Each resource (product, orders, etc) has a new metafield
field. When you choose metafield
, you can select from a list of known metafields for that resource:
Selecting the metafield will generate an alias
, which Flow uses to get the metafield data, and you can use in subsequent steps and liquid. The variable will show up in a group titled Fields with arguments
:
You can also now use metafield types in Flow. For example a product reference named recipe
would allow you to get the title of the product in that reference, like {{ product.recipe.value.title }}
.
Why
Previously when trying to check metafields in Flow, you needed to loop over the metafields list on resources, such as:
liquid
{% for mf in product.metafields %}
{% if mf.namespace == “custom” and mf.key == “yourkey” %}
{{ mf.value }}
{% endif %}
{% endfor %}
Metafields accessed this way were all treated like a string, and could cause performance issues if there were many metafields, or if the value field was very large. For these reasons, this old way of accessing metafields will be deprecated soon from the Flow app.
For questions and feedback, you can post to the Shopify community.