Not able to filter orders with not empty email

Solved

Not able to filter orders with not empty email

alessmar
Shopify Partner
6 0 0

I'm trying to get the orders with email attribute not null.

 

I tried with this query but I always get an empty result set:

 

{
	orders(first: 180, query: "email:*") {
		edges {
			node {
				id
				name
				email
				shippingLines (first:10) {
					edges {
						node {
							code
						}
					}
				}
			}
		}
	}
}

 

If I remove the "query" filter I get several results.

 

I tried with different API versions until 2024-04 but the behaviour is always the same.

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hey @alessmar

 

Thanks for sharing that. Testing here, I do notice that in the format you've shared, it's returning all orders, regardless of if there is a null email or not. 

 

When I add a greater-than-or-equal-to comparator, it returns only the orders that have an email. 

 

orders(first: 180, query: "email:>=*")

Hope that helps, 

 

Kyle G. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 508

This is an accepted solution.

Hey @alessmar

 

Thanks for sharing that. Testing here, I do notice that in the format you've shared, it's returning all orders, regardless of if there is a null email or not. 

 

When I add a greater-than-or-equal-to comparator, it returns only the orders that have an email. 

 

orders(first: 180, query: "email:>=*")

Hope that helps, 

 

Kyle G. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog