Hi all,
For my products, I have a metafield that defines length (.custom.length), and one that defines shape(.custom.shape).
I am trying to create a flow, where when triggered, updates the cutline metafield (theme.cutline) to their length and shape values. All three metafields are single lined texts. (So for example length value = Medium and shape value = Oval, cutline value with be “Medium Oval”
After research I see that for liquid I need to do something like this:
{% for metafields_item in product.metafields %}
{% if metafields_item.namespace == "custom" and metafields_item.key == "length" %}
{{metafields_item.value}}
{% endif %}
{% endfor %}
I’ve also tried this:
{% for metafields_item in product.metafields %}
{% if metafields_item.namespace == "custom" and metafields_item.key == "length" %}
{% assign length_value = metafields_item.value %}
{% endif %}
{% endfor %}
{{ length_value }}
But both returns this when run:
Got error updating metafield: “Value must be a single line text string.” For value: “\n \n Medium\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n\n”, Type: single_line_text_field
Is there any way I can fix this? Thank you!