Thank you, what a ball ache that was
Topic summary
Converting prefixed product tags (e.g., “Colour:”, “Category:”) into a metafield of type “List of single line strings” in Shopify Flow to power collection filters.
Initial issue: only one value populated and array format errors. The list metafield expects a JSON-like array of quoted strings with commas and brackets (e.g., [“item1”, “item2”]). Attempting to manage commas with forloop.last inside an if caused errors.
Working approach (Liquid in Flow):
- Loop product.tags and select those containing the desired prefix.
- Remove the prefix (remove_first) and trim whitespace (strip).
- Quote each value and add a trailing comma while capturing to a variable.
- After the loop, remove the final comma (remove_last) and wrap values in square brackets.
Follow-up: “Category” matched “Sub-Category” due to substring overlap. Resolved by adding an unless condition to exclude tags containing “Sub-Category” when building the Category list.
Outcome: Solution confirmed working; suggested adding example to Shopify Flow docs. Code snippets are central; screenshots were illustrative but not essential. Discussion resolved.