Automattic\WooCommerce\Blocks\BlockTypes

Checkout::hydrate_from_api()protectedWC 1.0

Hydrate the checkout block with data from the API.

Метод класса: Checkout{}

Хуков нет.

Возвращает

null. Ничего.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->hydrate_from_api();

Код Checkout::hydrate_from_api() WC 7.7.2

protected function hydrate_from_api() {
	$this->asset_data_registry->hydrate_api_request( '/wc/store/v1/cart' );

	// Print existing notices now, otherwise they are caught by the Cart
	// Controller and converted to exceptions.
	wc_print_notices();
	add_filter( 'woocommerce_store_api_disable_nonce_check', '__return_true' );

	$rest_preload_api_requests = rest_preload_api_request( [], '/wc/store/v1/checkout' );
	$this->asset_data_registry->add( 'checkoutData', $rest_preload_api_requests['/wc/store/v1/checkout']['body'] ?? [] );

	remove_filter( 'woocommerce_store_api_disable_nonce_check', '__return_true' );
}