Add Customer Tags based on products in the order

Jkatz23
Tourist
11 0 8

Hi,

I am looking to tag the customer with the product titles in the order they just created.  But it only allows me to do the first one because i can only add this to the tag field, {{order.lineItems.title}}.  I cannot find where to add in the loop.  I have read you can do it, but i cant seem to find where.

This is where I read it: https://help.shopify.com/en/manual/shopify-plus/flow/examples#template-variables-and-liquid-examples

Below is what the flow looks like, its very simple, it just needs that loop.

Any help is greatly appreciated.

Jordan

Screen Shot 2021-11-01 at 5.17.21 PM.png

Replies 5 (5)

JoesIdeas
Shopify Expert
2195 201 588

Have you tried using an inline Liquid loop in there? I'm not that familiar with Shopify flow but the docs say it accepts liquid ("Text fields that support template variables also support for loops and the forloop object."), so maybe you could use this:

{% for item in order.lineItems %}{{ item.title}}{% endfor %}

Or, if you need to separate them, maybe you could try adding a comma:

{% for item in order.lineItems %}{{ item.title}},{% endfor %}

 

If you aren't able to do it with Flow and need something more powerful / customizable I have an app that can do stuff like this (Order Automator). For your case it seems like you could do it right in Shopify Flow though if you can get those loops working, so I'd give it a try first with the liquid loops.

 

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks
Jkatz23
Tourist
11 0 8

Thanks for your reply, but the tag field allows you to type a tag and then it puts it below, so i could add multiple tags, they just cant be looped.... see screenshot, after i entered what you sent and hit enter this is what it looks like... Screen Shot 2021-11-01 at 7.28.54 PM.png

JoesIdeas
Shopify Expert
2195 201 588

Weird error, because the forloop looks closed to me... hmmm, what about that </>, maybe you can click on that to open up a code view, so you can use that loop code?

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks
Jkatz23
Tourist
11 0 8

When you click that it opens up the variable action or condition selector....see screenshot of how i originally got the line item title into my flow. Do you have access to flow that you could try?Screen Shot 2021-11-01 at 8.26.27 PM.png

JoesIdeas
Shopify Expert
2195 201 588

Ok, hmm ya I'm not sure by that screenshot. I don't have a Shopify Flow installation to test but I wouldn't mind checking it out and see if I can figure this out, if you want me to try on yours send me a message with your store url and I'll send a collaborator request and see if I can identify it. I won't make any changes, I'll just cruise around to see if I can identify how to achieve what you're looking to do, then will pass it on.

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks