Automattic\WooCommerce\StoreApi
StoreApi::init
Init and hook in Store API functionality.
Метод класса: StoreApi{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$StoreApi = new StoreApi(); $StoreApi->init();
Код StoreApi::init() StoreApi::init WC 10.4.0
public function init() {
add_action(
'rest_api_init',
function () {
if ( ! wc_rest_should_load_namespace( 'wc/store' ) && ! wc_rest_should_load_namespace( 'wc/private' ) ) {
return;
}
self::container()->get( Legacy::class )->init();
self::container()->get( RoutesController::class )->register_all_routes();
}
);
// Runs on priority 11 after rest_api_default_filters() which is hooked at 10.
add_action(
'rest_api_init',
function () {
if ( ! wc_rest_should_load_namespace( 'wc/store' ) ) {
return;
}
self::container()->get( Authentication::class )->init();
},
11
);
add_action(
'woocommerce_blocks_pre_get_routes_from_namespace',
function ( $routes, $ns ) {
if ( 'wc/store/v1' !== $ns ) {
return $routes;
}
$routes = array_merge(
$routes,
self::container()->get( RoutesController::class )->get_all_routes( 'v1' )
);
return $routes;
},
10,
2
);
}