Automattic\WooCommerce\Blocks\BlockTypes

SingleProduct::initializeprotectedWC 1.0

Initialize the block and Hook into the render_block_context to update the context with the correct data.

Method of the class: SingleProduct{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

SingleProduct::initialize() code WC 10.7.0

protected function initialize() {
	parent::initialize();
	add_filter( 'render_block_context', [ $this, 'update_context' ], 10, 3 );
	add_filter( 'render_block_core/post-excerpt', [ $this, 'restore_global_post' ], 10, 3 );
	add_filter( 'render_block_core/post-title', [ $this, 'restore_global_post' ], 10, 3 );
}