Split metafield single line text into metafield single line list

Right now I only seem able to import single line text to metafields via API.

For example I get “Funk, Soul, Disco” when I really want “Funk” “Soul” “Disco” as list items (like a recipe).

Is it possible to ceate a snippet of code similar to this that would split them?

{{ product.metafields.custom.style | split: ", "}}

I’ve tried using flow and I’ve tried using the theme edit code area (new snippet) but no luck so far. What am I doing wrong because it didn’t work. I have almost zero coding experience but I enjoy the challenge of trying to work it out.

Hi @FurtherRecords

I do not think you give the value in you flow like that. You might want to change it to text “Funk, Soul, Disco”

Try this code instead

{% assign meta_style = product.metafields.custom.style.value | split: "," %}
{% for style in meta_style %}
{{ style | append: "'", | prepend: | "'" }}
{% endfor %}