Flow Error using Metafield: Value must be a single line text string

I am attempting to create a Flow that updates an Order’s metafield with a value from Company Location. The intent is to capture a Bill To Email on orders.

The trigger is Order Created

The Action is Update Order Metafield

Metafield namespace: custom

Key: bill_to_email

Value: I am attempting to pull in a metafield value from Company Location. This seems to pull the correct value.

{% for metafields_item in order.purchasingEntity.PurchasingCompany.location.metafields %}
{{metafields_item.value}}
{% endfor %}

Type: Single line text (Both the source and target metafields are also single line text)

The correct value is pulled however it returns the following error.

Got error updating metafield: “Value must be a single line text string.” For value: “\n kara@tinkercoffee.com\n”, Type: single_line_text_field

SOLVED: This thread solved the issue and removed the /n.

https://community.shopify.com/c/shopify-flow-app/shopify-flow-value-from-custom-customer-metafield-is-returned/td-p/2085241

the \n character indicates a new line

Thanks Max. Do you know now to remove the /n?

SOLVED: This thread solved the issue and removed the /n. Adding ‘-’ inside the %s did the trick and removed ‘/n’.

https://community.shopify.com/c/shopify-flow-app/shopify-flow-value-from-custom-customer-metafield-is-returned/td-p/2085241

1 Like