What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: Shopify Flow Zip Codes Order Tagging

How can I tag orders by zip code using Shopify Flow?

DavidETGB
Tourist
6 1 2

My goal is to have Flow look through a list of zip codes that I provide and then to assign a zone order tag if it reads as true that a specific zip code is found.

My problem is that I am pulling a list of around 900 zip codes from a csv file, that I am entering all at once in list format in the zip code field in Flow. Shopify Support recommended I enter each zip code 1 by 1 and hit enter 900 times... Is there a way to tell Flow to look at the full list and go through each zip code entered within that list? Perhaps a built in "or" function somehow? Example list: Zip1, Zip2, Zip3, Zip4, Zip5.

 

08-23-2023(2).JPG

Thank you for any help or recommendations.

Replies 12 (12)

paul_n
Shopify Staff
1445 157 334

Includes will match the string you provide in the zip field, not the other way around. I think you want the operator to be "is at least one of". With that you can provide a list like tags.

 

Alternatively, you could store the zips in a shop metafield and then check is the shop metafield includes the new zip. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DavidETGB
Tourist
6 1 2

Will "is at least one of" check each zip code in the entire string or will it act like the entire string is just 1 record? I cannot sit here and press enter 900 times to enter each zip code individually (see red pen below); I have a full list that is put in the zip field under 1 entry/record (see blue pen). Is there a function / way to put a separator within my list that will automatically break the zip codes into their own entries?

 

Thank you.

 

08-23-2023(3).JPG

paul_n
Shopify Staff
1445 157 334

We don't auto-split that field on characters because sometimes you want the characters. If you use the shop metafields option then you can just copy and paste them in. 

The flow part:

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DavidETGB
Tourist
6 1 2

Hi Paul,

 

I tried setting it up through metafields and based on today's orders, it hasn't worked yet. In the metafields setup, I entered the zip codes as a list, but it seems like maybe I have to enter each one individually (highlighted yellow below)? Here is what I have so far:

 

08-24-2023(1).JPG08-24-2023(2).JPG

 

Thank you for any help.

paul_n
Shopify Staff
1445 157 334

Those are validations. You need to set the "values". It's not in the Shopify UI yet...so you need to use an app like Metafields Guru to set them. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
uttamk
Visitor
2 0 0

Did this thread get resolved? I am in desperate need of the ability to add a list of zip codes and apply a tag given theres a match with at least 1.

paul_n
Shopify Staff
1445 157 334

You can already do that in Flow. After you choose the zip code field in a condition, choose "Is at least one of". Then enter the zips like tags. Using metafields allows you to do that outside of Flow, but it's harder to set up.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DavidETGB
Tourist
6 1 2

Hi @uttamk if you have a long list to enter like I did, you have to use excel to do some quick formatting first, your output should look like this with your zips in quotes and the entire list in brackets, exactly as below:
["99997", "99998", "99999"]

Then copy and paste that into shopify flow, under the zip code field. You have to start with the "equals" or "includes" option first, paste the list (with brackets) and then change the option to "is at least one of". I figured this out with a lot of trial and error, it's not intuitive at all.

Let me know if you need more detail.

paul_n
Shopify Staff
1445 157 334

That's quite a find! Flow has some conversion logic in there apparently.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
LFBFanShop
Visitor
1 0 0

Hey David, do you know if this or similar will work for the "starts with" conditional logic? I'm in Canada and we use Postal Codes with a M1M 1M1 format and I need to check for strings like "M4" or "M1C" but only at the beginning of the string.

DavidETGB
Tourist
6 1 2

Hi @LFBFanShop ,
It depends how many variables you have, what the formatting is and what you want the output to be. I would need more context about what you want the end result to be and how you would want to get there. I'm not that familiar with Canadian postal code format but I will try to help. In your case, if you want each string to have a different output, then you will have to enter them in as a separate condition. If you have a large group of postal codes that you want to have the same output, you can input them in the "is at least one of" logic using the method I did above (but you will have to input the entire postal code with exact formatting). If you have a small group of strings that you want to have the same output, you can do the "starts with" logic and then enter multiple strings within the same condition, just like how you would enter in product tags (I believe each entry in the same condition will act as "or" logic.) I hope this helps, let me know!

 

 

uttamk
Visitor
2 0 0

Following up here on our status - we actually ended up switching off of flow. It was very much a challenge to implement this specific logic and I felt it was unreliable for what we needed which was crucial for our shipment flow. I ended up writing a very basic script in windmill.dev that listened to a shopify order webhook, calculated the right tag, then used the graphql api to modify the tag for a given input order id. It works like a charm and was very inexpensive!! I think this product needs a lot more love and documentation.