Search code examples
wordpressrestwoocommercewoocommerce-rest-apiwordpress-rest-api

WooCommerce REST API - Filter Orders By Date Modified


I'm using the WooCommerce REST API (http://woocommerce.github.io/woocommerce-rest-api-docs/#introduction) and can download Customers, Orders, etc successfully.

I'm now trying to get a filtered list of Orders where the Date Modified for the Order is after a certain date, but haven't been able to get this to work so far. The response to get GET request for an Order includes:

"date_modified": "2016-12-21T00:33:38",

I've tried the following:

wp-json/wc/v1/orders?filter[modified]=2017-02-14

but that just returns all orders. I would like to change the = to be a >= so it gets all Orders after the specified date, but haven't been able to find an example of how to structure the request URL for this?


Solution

  • I was able to get this working using the following request format:

    wc-api/v1/orders?filter[updated_at_min]=2017-02-22&filter[updated_at_max]=2017-02-25