Check if welcome message notice exists before creating it (https://github.com/woocommerce/woocommerce-admin/pull/2063)

This commit is contained in:
Albert Juhé Lluveras 2019-04-16 09:31:50 +02:00 committed by GitHub
parent f8144e38f5
commit d38b888a2e
1 changed files with 7 additions and 1 deletions

View File

@ -18,13 +18,19 @@ class WC_Admin_Notes_Welcome_Message {
* Creates a note for welcome message.
*/
public static function add_welcome_note() {
// Check if plugin is upgrading if yes then don't create this note.
$is_upgrading = get_option( WC_Admin_Install::VERSION_OPTION );
if ( $is_upgrading ) {
return;
}
// See if we've already created this kind of note so we don't do it again.
$data_store = WC_Data_Store::load( 'admin-note' );
$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
if ( ! empty( $note_ids ) ) {
return;
}
$note = new WC_Admin_Note();
$note->set_title( __( 'New feature(s)', 'woocommerce-admin' ) );
$note->set_content( __( 'Welcome to the new WooCommerce experience! In this new release you\'ll be able to have a glimpse of how your store is doing in the Dashboard, manage important aspects of your business (such as managing orders, stock, reviews) from anywhere in the interface, dive into your store data with a completely new Analytics section and more!', 'woocommerce-admin' ) );