closeup photo of ferret

Remove WooCommerce DB Notices

Sometimes WooCommerce gets stuck showing admins the same notices over and over, even when the action has been completed. WooCommerce database update done is a common culprit.

One solution is to manually mark the actions as “actioned” in the database. You’ll find a table wp_wc_admin_notes where you can see unactioned messages. Simple change unactioned to actioned and the messages will go away.

Another way to do this is using this snippet dropped into your functions.php file – it will clear them all in bulk, be sure to remove it once it’s done it’s job.

function woocommerce_set_database_update_notice_as_actioned() {
    // Bail if WoocCommerce notes class is not present.
    if ( ! class_exists( 'WC_Notes_Run_Db_Update' ) ) {
        return;
    }

    $woocommerce_notes_db = new WC_Notes_Run_Db_Update();
    $woocommerce_notes_db->set_notice_actioned();
}
add_action( 'admin_notices', 'woocommerce_set_database_update_notice_as_actioned' );

 


2 Comments

  • Gabriele

    April 13, 2021

    Oh! Finally!
    Thank you so much.

    Ciao.

    Reply
  • Tony Hisir

    August 25, 2021

    Hi,

    Thank you very much. It worked perfectly. It was annoying.

    Kind regards,
    Tony

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.