Automattic\WooCommerce\Blocks\Templates

AbstractTemplateCompatibility::set_compatibility_layer_flagpublicWC 1.0

Check if the current template has a legacy template block and disable the compatibility layer if it does.

Method of the class: AbstractTemplateCompatibility{}

Returns

null. Nothing (null).

Usage

$AbstractTemplateCompatibility = new AbstractTemplateCompatibility();
$AbstractTemplateCompatibility->set_compatibility_layer_flag();

AbstractTemplateCompatibility::set_compatibility_layer_flag() code WC 11.0.1

public function set_compatibility_layer_flag() {
	$current_template_has_legacy_template_block = $this->current_template_has_legacy_template_block();

	/**
	 * Filter to determine whether the compatibility layer should be disabled.
	 *
	 * @since 11.0.0
	 * @param bool $should_disable_compatibility_layer Whether the compatibility layer should be disabled.
	 */
	$should_disable_compatibility_layer = apply_filters( 'woocommerce_disable_compatibility_layer', $current_template_has_legacy_template_block );

	if ( $should_disable_compatibility_layer ) {
		add_filter( 'woocommerce_disable_compatibility_layer', '__return_true' );
	}
}