I have a Woocommerce shop and I'm using the Woocommerce REST API to list products etc. on another site and it works fine. There are some functionality that I'm missing though, and I'm wondering if it is possible to extend the API with custom calls?
I was able to figure out how to this by reading the source code for Woocommerce.
First I had to create a class that extends WC_API_Resource and add my routes in the register_routes method of this class. Then I had to make sure that Woocommerce adds this class to the API by adding the class to the class-array in the woocommerce_api_classes filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With