Skip to Content

woocommerce_admin_notices()

Enables admin notifications when WooCommerce is active.

PHP April 27, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

Currently this function checks if the WooCommerce Google Analytics and/or Enhanced Ecommerce Google Analytics plugins are active. Only the latter is desired.

Source File

Located in /libs/Ecommerce.php on line 40.

No Hooks

This function does not have any filters or actions available. Request one?
PHP
        public function woocommerce_admin_notices($nebula_warnings){
            //Check for problematic plugin WooCommerce Google Analytics Integration
            if ( is_plugin_active('woocommerce-google-analytics-integration/woocommerce-google-analytics-integration.php') ){
                $nebula_warnings[] = array(
                    'level' => 'error',
                    'description' => '<i class="far fa-fw fa-credit-card"></i> It is recommended to deactivate and remove the plugin WooCommerce Google Analytics Integration in favor of the plugin Enhanced Ecommerce Google Analytics Plugin for WooCommerce. <a href="plugins.php">Manage Plugins &raquo;</a>'
                );
            } elseif ( file_exists(WP_PLUGIN_DIR . '/woocommerce-google-analytics-integration') ){
                $nebula_warnings[] = array(
                    'level' => 'warn',
                    'description' => '<i class="far fa-fw fa-credit-card"></i> The plugin WooCommerce Google Analytics Integration is deactivated but should be removed entirely! <a href="plugins.php">Manage Plugins &raquo;</a>'
                );
            }

            //Check for approved plugin Enhanced Ecommerce Google Analytics Plugin for WooCommerce
            if ( !file_exists(WP_PLUGIN_DIR . '/enhanced-e-commerce-for-woocommerce-store') ){
                $nebula_warnings[] = array(
                    'level' => 'warn',
                    'description' => '<i class="far fa-fw fa-credit-card"></i> WooCommerce is active, but the recommended plugin Enhanced Ecommerce Google Analytics Plugin for WooCommerce is not installed. <a href="themes.php?page=tgmpa-install-plugins">Install Recommended Plugins &raquo;</a>'
                );
            } elseif ( !is_plugin_active('enhanced-e-commerce-for-woocommerce-store/enhanced-ecommerce-google-analytics.php') ){
                $nebula_warnings[] = array(
                    'level' => 'warn',
                    'description' => '<i class="far fa-fw fa-credit-card"></i> WooCommerce is active, but while the recommended plugin Enhanced Ecommerce Google Analytics Plugin for WooCommerce is installed, it is not activated. <a href="plugins.php">Manage Plugins &raquo;</a>'
                );
            }

            return $nebula_warnings;
        }

Override

This function can not be short-circuited with an override filter. Request one?