Any way to add product tags from metafield?

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!