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
User | RANK |
---|---|
3 | |
1 | |
1 | |
1 | |
1 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023