Adding metafield information from prefixed tags

Topic summary

A user seeks to automatically populate product metafields from prefixed tags (e.g., ‘brand_nike’) using Shopify Flow, since they cannot fully transition to metafields due to collection limitations and listing integrations.

Solution Provided:

  • Flow can extract tag values after a prefix using Liquid code in the ‘Update product metafield’ action
  • Template available: ‘Update a product metafield if a product tag has a certain prefix’
  • Example Liquid: {% for tag in product.tags %}{% if tag contains "brand_" %}{{ tag | remove: "brand_" }}{% endif %}{% endfor %}

Key Limitations:

  • No ‘product updated’ or ‘tag updated’ trigger exists; only works on product creation or status changes
  • Manual backfill possible via ‘Run Flow automation’ under ‘More actions’ for existing products

Common Issues Resolved:

  • Error: ‘Value must be a single line text string’ - caused by empty values or case sensitivity mismatches between Flow conditions and Liquid code
  • Solution: Use exact case matching or normalize with uppercase/lowercase, add hyphens to remove whitespace ({{- tag -}})

Alternative Approach:

  • One user successfully reversed the workflow: setting metafields with predefined options first, then generating tags from metafields to reduce human error
  • ‘Run code action’ template now available as an app-free alternative
Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Here’s a link to the template: https://shopify.com/admin/apps/flow/web/editor/templates/908286d2-3e4c-4d9d-8e28-3cf9b12db4df

If that doesn’t work, look for the one titled, “Update a product metafield if a product tag has a certain prefix”