Custom REST API endpoint using rest_api_init no longer works
-
After updating Woocommerce to latest I am unable to create a custom REST API endpoint.
This used to work:
add_action('rest_api_init', 'api_reduce_stock_endpoint');
function api_reduce_stock_endpoint(){
register_rest_route('wc/v3/products', 'dec', array(
'methods' => 'PUT',
'callback' => 'reduce_stock_by_sku',
'permission_callback' => function($request){
return is_user_logged_in();
}
));
}This does no longer work and breaks the /wp-json/wc/v3/products/ endpoint.
Has there been changes to this?
The Legacy API is activated.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Custom REST API endpoint using rest_api_init no longer works’ is closed to new replies.