Hey @Usman_Manzoor, the issue is with your query syntax. The phone: parameter doesn’t have a value:
'email:customer@example.com OR phone:'
You can see exactly what’s happening by using the search query debugging header. Add this header to your request:
Shopify-Search-Query-Debug: 1
The response will include a parsed field showing how your query is being interpreted:
"parsed": {
"or": [
{"field": "email", "match_all": "customer@example.com"},
{"field": "default", "match_all": "phone"}
]
}
The empty phone: is being parsed as a search for the literal word “phone” in the default field, not as a phone field search. That’s why you’re getting unexpected customers, it’s matching anyone with “phone” in their searchable data.
Here’s the correct syntax depending on what you’re trying to achieve:
If you want customers with a specific email OR any phone number:
'email:customer@example.com OR phone:*'
If you want customers with a specific email OR a specific phone:
'email:customer@example.com OR phone:"+15551234567"'
If you only want to search by email:
'email:customer@example.com'
The wildcard * in phone:* matches any customer with a phone number, which gives you the proper OR logic you’re looking for. The debugging header is helpful for troubleshooting these kinds of query issues in the future.