Automattic\WooCommerce\Blocks\BlockTypes

RelatedProducts::initialize()protectedWC 1.0

Initialize this block type.

  • Hook into WP lifecycle.
  • Register the block with WordPress.
  • Hook into pre_render_block to update the query.

Method of the class: RelatedProducts{}

No Hooks.

Return

null. Nothing (null).

Usage

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

RelatedProducts::initialize() code WC 9.4.2

protected function initialize() {
	parent::initialize();
	add_filter(
		'pre_render_block',
		array( $this, 'update_query' ),
		10,
		2
	);

	add_filter(
		'render_block',
		array( $this, 'render_block' ),
		10,
		2
	);

}