Automattic\WooCommerce\Admin\Features\ProductBlockEditor

Init::register_product_templatespublicWC 1.0

Register product templates.

Method of the class: Init{}

Returns

null. Nothing (null).

Usage

$Init = new Init();
$Init->register_product_templates();

Init::register_product_templates() code WC 10.9.4

public function register_product_templates() {
	if ( has_filter( 'woocommerce_product_editor_product_templates' ) ) {
		wc_deprecated_hook(
			'woocommerce_product_editor_product_templates',
			self::DEPRECATED_SINCE,
			null,
			'This product editor extension filter will be removed in WooCommerce 11.0.'
		);
	}

	/**
	 * Allows for new product template registration.
	 *
	 * @since 8.5.0
	 * @deprecated 10.9.0 Product editor extension APIs will be removed in WooCommerce 11.0.
	 */
	$this->product_templates = apply_filters( 'woocommerce_product_editor_product_templates', $this->get_default_product_templates() );
	$this->product_templates = $this->create_default_product_template_by_custom_product_type( $this->product_templates );

	usort(
		$this->product_templates,
		function ( $a, $b ) {
			return $a->get_order() - $b->get_order();
		}
	);

	$this->redirection_controller->set_product_templates( $this->product_templates );
}