Automattic\WooCommerce\Blocks\Templates
AbstractTemplateCompatibility::set_compatibility_layer_flag
Check if the current template has a legacy template block and disable the compatibility layer if it does.
Method of the class: AbstractTemplateCompatibility{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$AbstractTemplateCompatibility = new AbstractTemplateCompatibility(); $AbstractTemplateCompatibility->set_compatibility_layer_flag();
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' );
}
}