Woocommerce non-dismissble WooPayments notice
Someone on facebook posted they had a notice they cant dismiss, I first thought it was another bug like this or this which happens with notices sometimes. But they say
Woo support told me to do one because I don’t have a paid WordPress plan
Which doesnt make any sense, since its not a license notice or anything, its just an info notice. I looked into it and they definitely set the notice to non-dismissable on purpose. Note “is_snoozable” is set to 0.
INSERT INTO `wp_wc_admin_notes` (`name`, `type`, `locale`, `title`, `content`, `status`, `source`, `is_snoozable`, `layout`, `image`, `is_deleted`, `content_data`, `date_created`, `date_reminder`) VALUES (‘woocommerce-WooPayments-Aug-2023-security-updated’, ‘update’, ‘en_US’, ‘Security update of WooPayments (WooCommerce Payments) plugin’, ‘<strong>Your store has been updated to the more secure version of WooPayments (WooCommerce Payments)</strong>. This update was released on July 31.’, ‘pending’, ‘woocommerce.com’, ‘0’, ‘plain’, ”, ‘0’, ‘{}’, ‘2023-08-09 04:06:27’, NULL)
I am not gonna discuss if this is ethical or shady it just doesnt make sense so I am going to post the solution here:
(hope it works – waiting for feedback from them)
add_action( ‘admin_notices’, ‘fix_wc_payments_notice_aug23sec’ );
function fix_wc_payments_notice_aug23sec() {
global $wpdb;
$wpdb->update( $wpdb->prefix . ‘wc_admin_notes’, [‘is_snoozable’=>’1’], [‘name’=>’woocommerce-WooPayments-Aug-2023-security-updated’] );
}