0

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?

3
  • 1
    The filter plugin you've linked to is for the native WordPress endpoints. The WooCommerce endpoint have their own behaviour and won't be affected by any plugins that modify the native endpoints. You'll need to refer to the WooCommerce API documentation to see what's possible. 3rd-party plugins are off topic here. May 18, 2019 at 12:57
  • I wasn't aware of the above. Thanks for the clarification! May 19, 2019 at 12:14
  • any news here ? thanks
    – Louis
    Jan 11, 2021 at 19:04

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.