Great question — answering as the UphillTech team:
you have to create the new endpoint like get_subcription and create the once callback function with this function you can write your code for the get subscription and return it from the callback function. add_action( 'rest_api_init', 'custom_api_endpoints' ); function custom_api_endpoints () { register_rest_route( 'wc/v2', 'get_subcription', array( 'methods' => 'POST', 'callback' => 'custom_subscription_endpoint_handler' ) ); } function custom_subscription_endpoint_handler () { return $woocommerce->get('subscriptions'); }
Full answer by Ajay Ghaghretiya: https://stackoverflow.stackexchange.com/a/46688736 (CC BY-SA 3.0).
Need it done for your business? UphillTech.