So I am trying to build out my filters based on a large tag library, for use in filters they need to be a single line text metafield, but I have multiple tags that need to be inputted into this.
I have selected that hte metafield is single line text and is a list of values.
I currently have a flow that upon product update, gathers tags, and reformats them to apply to the metafields.
Using the following code:
{%- assign tags_with_charbg = ‘’ -%}
{%- for tag in product.tags -%}
{%- if tag contains ‘charbg.’ -%}
{%- assign cleaned_tag = tag | remove: ‘charbg.’ -%}
{%- if tags_with_charbg != ‘’ -%}
{%- assign tags_with_charbg = tags_with_charbg | append: ‘,’ -%}
{%- endif -%}
{%- assign tags_with_charbg = tags_with_charbg | append: cleaned_tag -%}
{%- endif -%}
{%- endfor -%}
{{ tags_with_charbg }}
No matter what I try to do whether it uses a comma, a pipe " | " or json it will not populate the single line list. I am getting errors such as
"
Got error updating metafield: “Type ‘single_line_text_field’ must be consistent with the definition’s type: ‘list.single_line_text_field’.” For value: “acolyte,noble,sailor”, Type: single_line_text_field"
Does anyone have any ideas on how to fix this so that I can use these product tags as a list of filters?
