Automattic\WooCommerce\Blocks\BlockTypes

MiniCart::initializeprotectedWC 1.0

Initialize this block type.

  • Hook into WP lifecycle.
  • Register the block with WordPress.

Method of the class: MiniCart{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->initialize();

MiniCart::initialize() code WC 11.0.1

protected function initialize() {
	parent::initialize();
	add_action( 'wp_loaded', array( $this, 'register_empty_cart_message_block_pattern' ) );
	add_action( 'wp_print_footer_scripts', array( $this, 'print_lazy_load_scripts' ), 2 );
	add_filter( 'hooked_block_woocommerce/mini-cart', array( $this, 'modify_hooked_block_attributes' ), 10, 5 );
	add_filter( 'hooked_block_types', array( $this, 'register_hooked_block' ), 9, 4 );

	// Priority 20 ensures this runs after WooCommerce block registration (priority 10)
	// allowing us to modify the block supports in the registry after registration is complete.
	add_action( 'init', array( $this, 'enable_interactivity_support' ), 20 );
}