WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\BlockTypes

MiniCart::enqueue_data() protected WC 1.0

Extra data passed through from server to client for block.

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

Hooks from the method

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.
Default: []

Code of MiniCart::enqueue_data() WC 5.9.0

protected function enqueue_data( array $attributes = [] ) {
	if ( is_cart() || is_checkout() ) {
		return;
	}

	parent::enqueue_data( $attributes );

	// Hydrate the following data depending on admin or frontend context.
	if ( ! is_admin() && ! WC()->is_rest_api_request() ) {
		$this->hydrate_from_api();
	}

	$script_data = $this->asset_api->get_script_data( 'build/mini-cart-component-frontend.js' );

	$num_dependencies = count( $script_data['dependencies'] );
	$wp_scripts       = wp_scripts();

	for ( $i = 0; $i < $num_dependencies; $i++ ) {
		$dependency = $script_data['dependencies'][ $i ];

		foreach ( $wp_scripts->registered as $script ) {
			if ( $script->handle === $dependency ) {
				$this->append_script_and_deps_src( $script );
				break;
			}
		}
	}

	$this->scripts_to_lazy_load['wc-block-mini-cart-component-frontend'] = array(
		'src'     => $script_data['src'],
		'version' => $script_data['version'],
	);

	$this->asset_data_registry->add(
		'mini_cart_block_frontend_dependencies',
		$this->scripts_to_lazy_load,
		true
	);

	$this->asset_data_registry->add(
		'displayCartPricesIncludingTax',
		'incl' === get_option( 'woocommerce_tax_display_cart' ),
		true
	);

	do_action( 'woocommerce_blocks_cart_enqueue_data' );
}