diff --git a/woocommerce-gutenberg-products-block.php b/woocommerce-gutenberg-products-block.php index 2948da393e3..ba00fb49ad0 100644 --- a/woocommerce-gutenberg-products-block.php +++ b/woocommerce-gutenberg-products-block.php @@ -25,14 +25,14 @@ } // Declare compatibility with custom order tables for WooCommerce. -if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { - add_action( - 'before_woocommerce_init', - function () { +add_action( + 'before_woocommerce_init', + function () { + if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); } - ); -} + } +); /** * Whether notices must be displayed in the current page (plugins and WooCommerce pages).