WordPress filter hook

woocommerce_disable_compatibility_layer

Defined by WooCommerce and fired by 8 plugins in total, running on 7.1M+ sites between them.

“Filter to disable the compatibility layer for the blockified templates.”

How to use woocommerce_disable_compatibility_layer

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_disable_compatibility_layer', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

8 plugins that fire woocommerce_disable_compatibility_layer

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:372
  2. Site Reviews icon Site Reviews60,000+ installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) plugin/Integrations/WooCommerce/Controllers/ProductController.php:185
  3. WebToffee Gift Cards for WooCommerce icon WebToffee Gift Cards for WooCommerce1,000+ installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) public/modules/gift_card/classes/class-wbte-gc-gift-card-free-purchase-setup-product-page.php:64
  4. Polski for WooCommerce icon Polski for WooCommerce80+ installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) src/Util/BlockLoop.php:39
  5. ProdTabs: Multilingual Product Tabs for WooCommerce icon ProdTabs: Multilingual Product Tabs for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) includes/class-block-accordion.php:230
  6. PN Scripts Tabcrest icon PN Scripts TabcrestFewer than 10 installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) src/Frontend/BlockCompat.php:82
  7. Peek icon PeekFewer than 10 installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) src/Service/PeekService.php:154
  8. WishlistGenius icon WishlistGeniusFewer than 10 installs apply_filters( 'woocommerce_disable_compatibility_layer', false ) includes/class-frontend.php:115

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.