Skip to Content
Menu

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.

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

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

    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['ecommerce_bad_ga_plugin'] = 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['ecommerce_bad_ga_plugin'] = 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['ecommerce_good_ga_plugin'] = 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['ecommerce_good_ga_plugin'] = 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?