I’m using the Woocommerce Rest API to grab orders using the following:
https://example.com/wp-json/wc/v3/orders?consumer_key=ck_xxx&consumer_secret=cs_xxx
How can I grab the completed orders for the current day?
I’m using the Woocommerce Rest API to grab orders using the following:
https://example.com/wp-json/wc/v3/orders?consumer_key=ck_xxx&consumer_secret=cs_xxx
How can I grab the completed orders for the current day?
2
Answers
According to the documentation, you can add GET parameters like "before", "after", and "status" to the retrieve order GET endpoint.
I’d combine those and see what response you get.
I can’t test at the moment, but I assume for the completed orders of 2021-12-01, your URL would look like this:
https://example.com/wp-json/wc/v3/orders?consumer_key=ck_xxx&consumer_secret=cs_xxx&status=completed&after=2021-11-30&before=2021-12-02
I’ve encountered the same issue today, and the dates need to be in the following
ISO8601
compliant format:So this is how the link should look like: