I have a script which exports WooCommerce orders (which sometimes change) and synchronizes them with an external database. I run this script frequently, and it uses the legacy v3 REST API.
I'm about to develop an always-running process which will keep the database synced all the time. The updates would be triggered in two ways. Primarily, I'd use webhooks for instant triggers.
Sometimes however, the sync process won't be running in which case some webhook triggers would be missed, so I need a way to retrieve the last couple updated orders to be synced upon restarting the sync process.
It's possible to query the last couple most recently updated orders with the legacy v3 REST API via filtering or sorting by the last updated date, but I'd much rather use the new v3 REST API this time which doesn't seem to allow this.
My best bet seems to be the WP REST filter plugin to allow for this via filtering, but it doesn't work based on my tests.
Any ideas?
I have a script which exports WooCommerce orders (which sometimes change) and synchronizes them with an external database. I run this script frequently, and it uses the legacy v3 REST API.
I'm about to develop an always-running process which will keep the database synced all the time. The updates would be triggered in two ways. Primarily, I'd use webhooks for instant triggers.
Sometimes however, the sync process won't be running in which case some webhook triggers would be missed, so I need a way to retrieve the last couple updated orders to be synced upon restarting the sync process.
It's possible to query the last couple most recently updated orders with the legacy v3 REST API via filtering or sorting by the last updated date, but I'd much rather use the new v3 REST API this time which doesn't seem to allow this.
My best bet seems to be the WP REST filter plugin to allow for this via filtering, but it doesn't work based on my tests.
Any ideas?
As it turns out, it's only possible to query the orders after a certain time with the legacy v3 WooCommerce REST API with the filter[updated_at_min]
parameter, not with the new v3 WooCommerce REST API.
I also want to query the customers who recently updated their data, which is impossible with any versions of the WooCommerce REST API to my knowledge.
It's possible to extend the WooCommerce REST API, but I'm fed up with the limitation and slowness of the REST API, and I also dislike PHP, so I'll probably end up directly querying the WordPress MySQL database from our ERP that uses node.js.
This post describes the related MySQL tables quite well.