I am working on a plugin to interact with a WooCommerce store and the problem is that the plugin and the store are on the same WordPress installation (same server and domain) and the WooCommerce Rest API didn’t work. I have already asked this question:
WooCommerce API Issue with Authentication Consumer Key is missing
My question: Is there a way to interact with WooCommerce directly without the Rest API, specially if my plugin and WooCommerce store are on the same server?
I finally found the solution, in order to access the WooCommerce API directly without using the REST API I first found great code on this link:
https://wordpress.org/support/topic/programming-question-memory-leak-when-accessing-products
And using this great link documentation
http://woocommerce.wp-a2z.org/oik_file/includesapiv2class-wc-api-orders-php/
Then by navigating in WooCommerce Source code in the plugins folder under
plugins/woocommerce/includes/api
I succeeded to access WooCommerce, here is a simple example to get products of a category and using page number:
You can use wp rest api. below example show you last 12 orders:
sources: https://wpscholar.com/blog/internal-wp-rest-api-calls/ , https://developer.wordpress.org/rest-api/reference/posts/#list-posts