Flow to convert multiple product tags to product metafield values

Topic summary

A user is migrating from product tags to metafields and needs to populate a single metafield with multiple values based on existing tags. For instance, products tagged “French” and “Modern” should have both values added to a “Period” metafield.

Current Issue:

  • The flow only adds one value to the metafield instead of both
  • Screenshots were shared showing the flow configuration (images appear corrupted in the thread)

Proposed Solution:
Another user recommends using code instead of standard flow actions:

  • Trigger: Product created
  • Condition: Check if tags contain target values
  • Action: Update product metafield using Liquid code to loop through tags and build the list
  • Alternative: Use a “Run code” action with JavaScript
  • A GitHub example for similar tag-to-metafield conversion exists (looks for tags with a specific prefix)

Status: Solution provided but not yet confirmed as implemented.

Summarized with AI on November 6. AI used: claude-sonnet-4-5-20250929.

I’m preparing to transition from tags to metafields, and need to create a flow to add multiple values to one metafield based on product tags. For example, a product might be tagged “French” and “Modern”, and both of those values should be added to the “Period” metafield.

The issue I’m having is that my flow will only add one value to the metafield, not both.

1 Like

The simpler way to do that is to write some code instead. Something like:

  • Product created
  • Condition (check is the tags is at least one of those values)
  • Update product metafield

Put liquid code in the update product metafield to loop over the tags and build that list. Or put in a Run code action to do that via JavaScript instead. This code example is similar, except it looks for tags that have a prefix on them. https://github.com/Shopify/flow-code-examples/blob/main/run-code-examples/product-tags-to-metafields/index.js

1 Like