How can I use regular expressions to tag PO Box orders in Shopify Flow?

Solved

How can I use regular expressions to tag PO Box orders in Shopify Flow?

ZLA1
Visitor
3 0 0

I am trying to create a shopify flow to tag orders which have a PO Box field in the shipping address.

The flow should tag any orders with possible variations such as -
po box;p.o.b.;pob;p.o. box;po-box;p.o.-box;PO-Box;p.o box;pobox;p-o-box;p-o box;post office box;P.O. Box;PO Box;g.p.o box;gpo box;g.p.o. box;g-p-o box;g-p-o-box;

 

I was told by shopify support to use a regular expression such as PO\s?Box\s?\d+

I can't get it to work and also not sure if using regular expressions whether we should be testing for the order.shippingAddress.address1 field to equal, include orstarts with 

Accepted Solution (1)
paul_n
Shopify Staff
1188 144 279

This is an accepted solution.

If you only wanted to use Flow, I'd probably do a basic check in a condition for "P" and "O" or maybe "box" and they write a check in liquid directly in the tag field. Just output nothing if it shouldn't add a tag. 

 

This is a good opportunity for a partner to make a custom Flow action that takes an address and checks if it has a a PO Box, returning true/false or something like that. 

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.

View solution in original post

Replies 3 (3)

paul_n
Shopify Staff
1188 144 279

Sigh, not sure why they said that. RegEx isn't supported yet. 

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.
ZLA1
Visitor
3 0 0

Thanks!
Is there a simple way to achieve this?

 

paul_n
Shopify Staff
1188 144 279

This is an accepted solution.

If you only wanted to use Flow, I'd probably do a basic check in a condition for "P" and "O" or maybe "box" and they write a check in liquid directly in the tag field. Just output nothing if it shouldn't add a tag. 

 

This is a good opportunity for a partner to make a custom Flow action that takes an address and checks if it has a a PO Box, returning true/false or something like that. 

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.