Search.json for 0 orders and updated_at_min?

Solved
melon
New Member
2 0 0

Hi,

I'm looking for a way to return customers which have 0 orders and updated_at_min.

From the https://shopify.dev/docs/admin-api/rest/reference/customers/customer, it shows a few search query options, however it uses updated_at instead of updated_at_min.

I was wondering if there's a simple way of doing this. I'd rather narrow down my results than filtering the results.


Any suggestions?

Thanks,

m

0 Likes
_JCC_
Shopify Staff
Shopify Staff
145 20 26

This is an accepted solution.

Hey @melon ,

Happy to help you out with this.

A customer search query should work for this purpose. For example the following customer search query would return all customers with no orders who's customer record was last updated after April 23rd 2021 @ 5:00pm eastern. More details on the Shopify search syntax can be found here.

/customers/search.json?query=orders_count:0 AND updated_at:>'2021-04-23T17:00:00-04:00'&fields=id,email,orders_count,updated_at

Hope this example helps, please let me know if you have any other questions.

Regards,

John

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

melon
New Member
2 0 0

Hi John,

That's perfect.

Thank you so much.

 

Regards,

m

0 Likes