user982124
user982124

Reputation: 4610

WooCommerce REST API - GET Customers Created After Date/Timestamp

I'm using the WooCommerce REST API to list all Customers which is working well.

I'm now trying to get a filtered list of Customers that were created after a specified date or timestamp. The Customer properties include a date_created field, e.g:

"date_created" : "2018-10-26T06:53:21"

but there is no after parameter when doing a GET to list all Customers like there is for the Orders endpoint. There is a search parameter but I'm not sure if that can be used to search for customers created after a timestamp, e.g. something like:

date_created≥2019-01-01T00:00:00Z

I can't find any examples of using the search parameter with dates/timestamps for filtering so not sure if this can be done?

Upvotes: 1

Views: 768

Answers (1)

Eduardo Mascarenhas
Eduardo Mascarenhas

Reputation: 21

I had the same problem. My work around was to work with the pagination. Order the query in either ascending or descending registered_date and you should see that recent dates will be either closer to the first page or the last. So you have to map out, at least roughly, which dates follow under which page. In my case I just need to keep real time tracking so I don't need to scan all pages like this.

But yeah, would be great to be able to design smarter queries for customers.

Upvotes: 2

Related Questions