Flow Error: Got error updating metafield: Value must be a single line text string

Topic summary

Issue: A Shopify Flow attempting to update an order metafield with a Company Location metafield value fails with the error “Value must be a single line text string,” despite both source and target metafields being configured as single line text type.

Flow Configuration:

  • Trigger: Order Created
  • Action: Update Order Metafield (namespace: custom, key: bill_to_email)
  • Value Source: Company Location metafield pulled via Liquid loop
  • Goal: Capture Bill To Email on orders

Problem: The Liquid code correctly retrieves the value, but the error persists even though the data appears to be single line text.

Resolution: Removing the \n (newline character) from the value resolved the issue. The newline was causing the validation error, as single line text fields cannot contain line breaks.

Summarized with AI on November 15. AI used: claude-sonnet-4-5-20250929.

I am attempting to create a Flow that updates Order 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. (both the source and target metafields are single line text and the value looks to me like it is single line text)

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/topic/2085241