Searching customer by email does not return exact match

elin2
Shopify Partner
4 0 0

I am using the customer api with query option to search customer by email, something like the following.

GET /admin/customers/search.json?query=email:test@gmail.com&fields=email,id

however, the result comes back with users with emails like 

test+1@gmail.com

test+2@gmail.com

test+3@gmail.com

Is there a way to force exact match?

0 Likes
monomyth_io
Tourist
5 0 0

Technically, those are all the same email address since mail sent to all three of those will arrive at test@gmail.com via the "+" alias functionality in Gmail.

 

https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html

0 Likes
markmason
New Member
1 0 3

That is true, they are gmail aliases, but within Shopify they are different customers complete with unique customer IDs.

Is there a way to have the graphql query return only the exact match?

 

I know that I can loop through what is returned and find the exact match, then perform a subsequent query using that ID, but it would be nice (and more efficient) to do everything in one trip.

folsen
New Member
2 0 3

Running into this same issue now, where query for test@gmail.com returns results for
test@gmail.com
test+1@gmail.com
test+2@gmail.com


and yet querying email with test+1@gmail.com returns a single result. 

Some flag or regex format for email matching would be preferred, or advising on how we can do this search especially now that the api is paginated would be appreciated

0 Likes