While I’m trying to extend Woocommerce Rest-API routes with a custom one I face the following problem. I have the following class which tries to hook inside Woocommerce API
class API_LOADER
{
public function init()
{
add_action( 'woocommerce_api_loaded', array( $this, 'load' ) );
}
public function load()
{
//This method will be not called
require_once plugin_dir_path( __FILE__ ).'wc-api-custom.php';
add_filter( 'woocommerce_api_classes', array( $this, 'register' ) );
}
}
but woocommerce_api_loaded
will not trigger any callback.
What I do wrong in this case