diff --git a/plugins/woocommerce/changelog/fix-41363 b/plugins/woocommerce/changelog/fix-41363 new file mode 100644 index 00000000000..16a4c96fef9 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-41363 @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Prevent possible notice during plugin activation. diff --git a/plugins/woocommerce/src/Internal/Features/FeaturesController.php b/plugins/woocommerce/src/Internal/Features/FeaturesController.php index 4ff11908ee7..0b6b7006d4c 100644 --- a/plugins/woocommerce/src/Internal/Features/FeaturesController.php +++ b/plugins/woocommerce/src/Internal/Features/FeaturesController.php @@ -7,8 +7,6 @@ namespace Automattic\WooCommerce\Internal\Features; use Automattic\WooCommerce\Internal\Admin\Analytics; use Automattic\WooCommerce\Admin\Features\Navigation\Init; -use Automattic\WooCommerce\Admin\Features\NewProductManagementExperience; -use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController; use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods; use Automattic\WooCommerce\Proxies\LegacyProxy; use Automattic\WooCommerce\Utilities\ArrayUtil; @@ -688,19 +686,21 @@ class FeaturesController { 'id' => empty( $experimental_feature_ids ) ? 'features_options' : 'experimental_features_options', ); - // Allow feature setting properties to be determined dynamically just before being rendered. - $feature_settings = array_map( - function( $feature_setting ) { - foreach ( $feature_setting as $prop => $value ) { - if ( is_callable( $value ) ) { - $feature_setting[ $prop ] = call_user_func( $value ); + if ( $this->verify_did_woocommerce_init() ) { + // Allow feature setting properties to be determined dynamically just before being rendered. + $feature_settings = array_map( + function( $feature_setting ) { + foreach ( $feature_setting as $prop => $value ) { + if ( is_callable( $value ) ) { + $feature_setting[ $prop ] = call_user_func( $value ); + } } - } - return $feature_setting; - }, - $feature_settings - ); + return $feature_setting; + }, + $feature_settings + ); + } return $feature_settings; }