Any way to add product tags from metafield?

Topic summary

A user encountered an error when trying to access product metafields (specifically a metaobject type) within Shopify Flow using Liquid code. The code worked correctly on the front-end but failed in Flow with the error message: “‘dress’ is invalid. Replace this variable.”

Key Issue:

  • Direct metafield access syntax (product.metafields.dress.neck.value) doesn’t work the same way in Flow as it does in theme Liquid

Solution Provided:

  • Liquid in Shopify Flow has different limitations compared to theme Liquid
  • Previously required looping through all metafields to match namespace and key
  • Current recommended approach: Configure metafield aliases in Flow for faster, direct access
  • Reference links provided to Shopify documentation on Flow metafield concepts and typed metafield access

Resolution: The issue was resolved with the metafield alias configuration method.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

The type of this metafield is metaobject

metafield: product.metafields.dress.neck.value

metaobject fields:neck.type , neck.img

My code is:

{% capture neck_tags %}
 {% for neck_type in product.metafields.dress.neck.value %}
  {{ neck_type.type.value }}{% unless forloop.last %},{% endunless %}
 {% endfor %}
{% endcapture %}
{{ neck_tags }}

Flow error message: “dress” is invalid. Replace this variable.

This code works normally in front-end test.

I don’t know what to do…

1 Like

Hi @Elvin_s

I asked GPT and here is the answer hope can solve your issue

https://chatgpt.com/share/67ff066a-fb80-800e-bc73-02c91a0314b7

thank you.

The code provided by GPT is the same as mine. actually I’ve tried gpt and claude.

My guess is that the shopify flow pairs have limited support for metaobjects,

But I can’t be sure of this

Liquid in flow is not quite the same as in theme.

If I am not mistaken, you had to loop over all metafields in Flow liquid to match namespace and key to get the metafield you want, there were no direct access. (https://community.shopify.com/c/shopify-flow-app/unable-to-access-any-shop-metafields-values-from-within-a-flow/m-p/1781225/highlight/true#M1034)

But now you may rather configure metafield alias in Flow to access metafield faster.

https://help.shopify.com/en/manual/shopify-flow/concepts/metafields

https://changelog.shopify.com/posts/shopify-flow-access-typed-metafields

1 Like

You saved me!