Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I'm working on a flow that looks up customers based on a specific tag. If a customer has this tag, I want to do two things:
The challenge is that the "For Each" loop can only connect to a single node, so I have to look up the same customers twice.
As a result, I end up with:
Is there a better way to handle this, so I can assign points and remove the tag in a single lookup without duplication or inconsistency?
Solved! Go to the solution
This is an accepted solution.
You shouldn't be looping over the "GetCustomerData" in the liquid for the action. That is looping over all the customers returned. Instead you want to use the specific customer in that instance of the for each loop (it will have foreach in the name).
You can do a single lookup and then use 2 for each loops, looping over the same list twice. Put the second loop in the "then" path of the first loop.
We do want to remove some restrictions on the "For each" loop, including allowing more than 1 action per loop. It's not close, though.
Hi Paul,
Thanks for the reply, this is how I started. But I got the same problems. With this setup (single lookup with 2 for each loops), it assigns the points 3 times to the customer metafield. +20 becomes +60. The get customer data lookup and both the for each loops seem to be a trigger for the JSON.
This is an accepted solution.
You shouldn't be looping over the "GetCustomerData" in the liquid for the action. That is looping over all the customers returned. Instead you want to use the specific customer in that instance of the for each loop (it will have foreach in the name).
I see, that makes sense. It works now.
Thanks Paul!
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025