WordPress at a glance
function is not described

Automattic\WooCommerce\Blocks\BlockTypes

Checkout::enqueue_data() protected WC 1.0

Extra data passed through from server to client for block.

{} It's a method of the class: Checkout{}

Return

Null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->enqueue_data( $attributes );
$attributes(array)
Any attributes that currently are available from the block. Note, this will be empty in the editor context when the block is not in the post content on editor load.

Code of Checkout::enqueue_data() WC 5.0.0

<?php
protected function enqueue_data( array $attributes = [] ) {
	$data_registry = Package::container()->get(
		AssetDataRegistry::class
	);

	if ( ! $data_registry->exists( 'allowedCountries' ) ) {
		$data_registry->add( 'allowedCountries', $this->deep_sort_with_accents( WC()->countries->get_allowed_countries() ) );
	}

	if ( ! $data_registry->exists( 'allowedStates' ) ) {
		$data_registry->add( 'allowedStates', $this->deep_sort_with_accents( WC()->countries->get_allowed_country_states() ) );
	}

	if ( ! $data_registry->exists( 'shippingCountries' ) ) {
		$data_registry->add( 'shippingCountries', $this->deep_sort_with_accents( WC()->countries->get_shipping_countries() ) );
	}

	if ( ! $data_registry->exists( 'shippingStates' ) ) {
		$data_registry->add( 'shippingStates', $this->deep_sort_with_accents( WC()->countries->get_shipping_country_states() ) );
	}

	$permalink = ! empty( $attributes['cartPageId'] ) ? get_permalink( $attributes['cartPageId'] ) : false;

	if ( $permalink && ! $data_registry->exists( 'page-' . $attributes['cartPageId'] ) ) {
		$data_registry->add( 'page-' . $attributes['cartPageId'], $permalink );
	}

	// Hydrate the following data depending on admin or frontend context.
	if ( is_admin() ) {
		$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;

		if ( $screen && $screen->is_block_editor() && ! $data_registry->exists( 'shippingMethodsExist' ) ) {
			$methods_exist = wc_get_shipping_method_count( false, true ) > 0;
			$data_registry->add( 'shippingMethodsExist', $methods_exist );
		}
	}

	if ( ! is_admin() && ! WC()->is_rest_api_request() ) {
		$this->hydrate_from_api( $data_registry );
		$this->hydrate_customer_payment_methods( $data_registry );
	}

	do_action( 'woocommerce_blocks_checkout_enqueue_data' );
}