How to Hide WooCommerce Update Notifications

WooCommerce Hide Update NotificationWooCommerce updates should be handled carefully, as you may break some functionality that could negatively affect your site. When it comes to WooCommerce updates, there are four schools of thought amongst store owners:

  • Some hit “update” without a second thought. This action can crash down your online store.
  • Some store owners ignore updates altogether, treating them like they do not exist.
  • Some have so many outdated plugins and themes. They are terrified of what will happen if they attempt an update.
  • Additionally, some store owners run regular backups, test new releases of WooCommerce on a staging site, and then update their live site without issue.

Ideally, it would be best if you run regular backups, test new releases of WooCommerce before updating your WooCommerce store. With the right tools in place, you can keep your WooCommerce site up-to-date. However, you might want to hide update notification. You can use a staging environment to test the update, which can be provided by your hosting company.

WooCommerce Hide Update Notifications

In this brief post, I will illustrate how you can hide update notifications in your WooCommerce Store. It is also worth mentioning that WordPress is such a delicate piece of software. Therefore, you should always know what to do before actually doing it.WooCommerce Update notifications

Developers know that the “Update Now” links are dangerous. However, other users who can access the back end of your WooCommerce store might not know that, for example, content editors.

However, there is a way you can disable the update notifications on a per-user basis. Moreover, it can be even easier if you are the only one who is seeing the notifications. The PHP snippet shared below is a little complex, but it works out.

Here are the steps that you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to hide update notifications on your WooCommerce store.
  3. Add the following code to the functions.php file:
/**

 *    Disable Update Notifications on the WordPress Dashboard

*/

 add_action( 'admin_init', 'njengah_hide_update_notifications_users' );

 function njengah_hide_update_notifications_users() {

    global $menu, $submenu;

    $user = wp_get_current_user();

   

    // ENTER HERE THE ONLY ALLOWED USERNAME

    $allowed = array( 'felixmatara' );

   

    // HIDE WP, PLUGIN, THEME NOTIFICATIONS FOR ALL OTHER USERS

    if ( $user && isset( $user->user_login ) && ! in_array( $user->user_login, $allowed ) ) {

        add_filter( 'pre_site_transient_update_core', 'njengah_disable_update_notifications' );

        add_filter( 'pre_site_transient_update_plugins', 'njengah_disable_update_notifications' );

        add_filter( 'pre_site_transient_update_themes', 'njengah_disable_update_notifications' );

       

        // ALSO REMOVE THE RED UPDATE COUNTERS @ SIDEBAR MENU ITEMS

        $menu[65][0] = 'Plugins up to date';  

        $submenu['index.php'][10][0] = 'Updates disabled';  

    }

}

 function njengah_disable_update_notifications() {

    global $wp_version;

    return (object) array( 'last_checked' => time(), 'version_checked' => $wp_version, );

}
  1. Once you enter the code, remember to update the functions.php file. This will hide the update notifications from other users, as shown below:hide update notifications

Conclusion

In summary, this post shares how you can hide WooCommerce update notifications from other users on your WooCommerce store. However, it is important to note that WooCommerce updates should be handled carefully. Moreover, I highly recommend that you should run regular backups, test new releases of WooCommerce before updating your WooCommerce store.

Similar Articles