Automattic\WooCommerce\Internal\Features
FeaturesController::maybe_display_feature_incompatibility_warning()
Shows a warning when there are any incompatibility between active plugins and enabled features. The warning is shown in on any admin screen except the plugins screen itself, since there's already a "You are viewing plugins that are incompatible" notice.
Method of the class: FeaturesController{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->maybe_display_feature_incompatibility_warning(): void;
FeaturesController::maybe_display_feature_incompatibility_warning() FeaturesController::maybe display feature incompatibility warning code WC 9.3.3
<?php private function maybe_display_feature_incompatibility_warning(): void { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $incompatible_plugins = false; $relevant_plugins = array_diff( $this->plugin_util->get_woocommerce_aware_plugins( true ), $this->plugins_excluded_from_compatibility_ui ); foreach ( $relevant_plugins as $plugin ) { $compatibility_info = $this->get_compatible_features_for_plugin( $plugin, true ); $incompatibles = array_filter( $compatibility_info['incompatible'], fn( $feature_id ) => ! $this->is_legacy_feature( $feature_id ) ); if ( ! empty( $incompatibles ) ) { $incompatible_plugins = true; break; } $uncertains = array_filter( $compatibility_info['uncertain'], fn( $feature_id ) => ! $this->is_legacy_feature( $feature_id ) ); foreach ( $uncertains as $feature_id ) { if ( $this->get_plugins_are_incompatible_by_default( $feature_id ) ) { $incompatible_plugins = true; break; } } if ( $incompatible_plugins ) { break; } } if ( ! $incompatible_plugins ) { return; } $message = str_replace( '<a>', '<a href="' . esc_url( add_query_arg( array( 'plugin_status' => 'incompatible_with_feature' ), admin_url( 'plugins.php' ) ) ) . '">', __( 'WooCommerce has detected that some of your active plugins are incompatible with currently enabled WooCommerce features. Please <a>review the details</a>.', 'woocommerce' ) ); // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped ?> <div class="notice notice-error"> <p><?php echo $message; ?></p> </div> <?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped }