set_title( __( 'Analytics now supports scheduled updates', 'woocommerce' ) ); $note->set_content( __( 'This provides improved performance to your store, enable it in Analytics > Settings.', 'woocommerce' ) ); $note->set_content_data( (object) array() ); $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); $note->set_name( self::NOTE_NAME ); $note->set_source( 'woocommerce-admin' ); // Add "Enable" action with custom handler. $note->add_action( 'scheduled-updates-enable', __( 'Enable', 'woocommerce' ), wc_admin_url(), Note::E_WC_ADMIN_NOTE_ACTIONED, true, __( 'Scheduled updates enabled', 'woocommerce' ) ); return $note; } /** * Enable scheduled updates when the action is triggered. * * @param Note $note The note being actioned. * @return void */ public function enable_scheduled_updates( $note ): void { // Verify this is our note. if ( self::NOTE_NAME !== $note->get_name() ) { return; } // Update the option to enable scheduled mode. update_option( self::OPTION_NAME, 'yes' ); } }