Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Whenever I try to reference any metafield namespace (i.e. "inventory") under shop.metafields, the linter activates with error message:
"inventory" is invalid. Replace this variable.
However, I have confirmed that this namespace exists by rendering {{shop.metafields.inventory | json}} to one of my Shopify pages via Custom Liquid.
Why does this happen, and what can I do to access shop.metafields within Flow?
You cannot access metafields that way in Flow. The theme liquid does something special to be able to accept those metafield namespaces and keys in that format. In Flow, you currently need to loop over metafields like:
{%- for mf on shop.metafields -%}
{% if mf.namespace == "my_name" and mf.key == "my_key" %}{{ mf.value }}{% endif %}
{%- endfor -%}
Hello Paul,
Thanks for this solution! However, I think I do not get it to work.
Am I missing something or is it not possible to access custom metafields? See screenshot attached.
Kind regards,
Koen
mf.namespace == "custom" and mf.key == "maten"
That makes a lot more sense, thanks for the prompt reply
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025