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 55.

    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
    
                //Note: May 2023 - Commented these all out as we need to start from scratch here with GA4. Everything is back on the table.
                    //This one (by Woocommerce itself) seems to be the best for GA4 without the bloat: https://wordpress.org/plugins/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="fa-regular fa-fw fa-credit-card"></i> It is recommended to deactivate and remove the plugin <a href="plugins.php">WooCommerce Google Analytics Integration</a> in favor of the plugin <a href="https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/" target="_blank" rel="noopener noreferrer">Google Analytics and Google Shopping plugin for WooCommerce</a>. <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="fa-regular 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 Google Analytics and Google Shopping 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="fa-regular fa-fw fa-credit-card"></i> WooCommerce is active, but the recommended plugin <a href="https://wordpress.org/plugins/enhanced-e-commerce-for-woocommerce-store/" target="_blank" rel="noopener noreferrer">Google Analytics and Google Shopping plugin for WooCommerce</a> 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="fa-regular fa-fw fa-credit-card"></i> WooCommerce is active, but while the recommended plugin <a href="plugins.php">Google Analytics and Google Shopping plugin for WooCommerce</a> 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?