Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
I am trying to combine two conditions with a logical AND in an advanced query in the Get customer data action in my workflow. My customers have the tag EdTest and live in the UK; so I would expect the following expression to evaluate to FALSE:
tag:EdTest AND default.defaultAddress.country:NotACountry
However, this evaluates to TRUE for all customers with the EdTest tag (as if the AND were in fact an OR). I've also tried a variation of the query syntax without the leading "default.":
tag:EdTest AND defaultAddress.country:NotACountry
but the result is the same. (See images below.)
How can I filter my customers based on a property of their address?
Solved! Go to the solution
This is an accepted solution.
You can't query by city or town. So if you want that, then segments is probably better.
Start here
https://help.shopify.com/en/manual/customers/customer-segmentation/create-customer-segments
Query filters don't allow you to use "." to specify the filter name, with the exception of metafields, so this is invalid and thus ignored by the API:
default.defaultAddress.country:NotACountry
Also, I'm not sure where you got "NotACountry" but that is unlikely to work in any situation.
The list of available query filters are here:
https://shopify.dev/docs/api/admin-graphql/2024-04/queries/customers#argument-query
There is a "country" filter. I'm not sure if it filters by default address or some other address. I'll note that the filter is also deprecated in favor of segments. So you may want to instead create a segment and use Segment Joined/Left triggers in conjunction with the segment.
Thanks Paul - that's helpful. How can I filter my customers according to the town or city in which they live (as specified in their default address)? Should I use segments instead? I've never heard of those, so if you could point me to some examples, that would be very helpful.
This is an accepted solution.
You can't query by city or town. So if you want that, then segments is probably better.
Start here
https://help.shopify.com/en/manual/customers/customer-segmentation/create-customer-segments
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025