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
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024