I’m still learning about making custom endpoints, however I am stuck on a particular challenge.
I have Woocommerce installed, and I know I can retrieve the list of products by calling http://localhost:8888/wp-json/wc/v2/products, however what I’m trying to do is create a custom endpoint that will retrieve more than just the list of products.
I want to call one endpoint, for example, custom/v1/home, and have that retrieve the the list of products from Woocommerce, the content on the about page, and also the site title.
I know how to create a custom endpoint getting simple things from WordPress, however I am not sure how to mix it with woocommerce api. Do I need to add
$output = wp_remote_get('https://localhost:8888/wp-json/wc/v2/products');
Or is there a better way to combine normal wordpress api and woocommerce?
Read more here: WordPress API Custom Endpoint