Flow to convert multiple product tags to product metafield values

Flow to convert multiple product tags to product metafield values

emilyfcny
Visitor
2 0 1

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.

 

Screenshot 2024-08-26 at 12.54.20 PM.pngScreenshot 2024-08-26 at 12.55.35 PM.pngScreenshot 2024-08-26 at 12.56.03 PM.png

 

Reply 1 (1)

paul_n
Shopify Staff
1295 148 297

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...

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.