How can I tag an order with a customer metafield value?

Hey hey, I’m trying to make a flow :

  • When a new order is created , the order to be tagged with a Customer Metafield value.

Currently trying the following ,and although on the flow app it says that it’s successful, the tag with the metafieled value is not added on the order.

I currently use :

  • {% for metafields_item in order.customer.metafields %} {if {metafields_item.namespace==“namespace” and metafields_item.key == “key” }},{ mf.value }{% endfor %}

Hi Raym1, there are a few issues in the code snippet you shared:

  • the mf.value is invalid. “mf” should match the variable used in the rest of the liquid code to output a variable.
  • the end if statement is missing after the metafield value
  • There are some inconsistencies with the liquid syntax

So the liquid code should look like this:

{% for metafields_item in order.customer.metafields %} 
{% if metafields_item.namespace == "namespace" and metafields_item.key == "key" %}
{{metafields_item.value}}
{% endif %}
{% endfor %}

Just make sure to swap out the namespace and key to match the metafield you want to add as a tag.

Hope this helps!

Appreciate your response Ethansz.
However, although the recent runs on the flow app say have the status: succeeded ,no tags are created on the order from the desired customer metafield value.

You have a typo…it should be {{metafields_item.value}} not {{ metafield.value}}