Remove Store Setup Alert (https://github.com/woocommerce/woocommerce-admin/pull/5499)
This commit is contained in:
parent
f657d108a3
commit
ce0ea8e12c
|
@ -7,7 +7,6 @@
|
|||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
use \Automattic\WooCommerce\Admin\Loader;
|
||||
use \Automattic\WooCommerce\Admin\Notes\OnboardingProfiler;
|
||||
use \Automattic\WooCommerce\Admin\PluginsHelper;
|
||||
use \Automattic\WooCommerce\Admin\Features\OnboardingSetUpShipping;
|
||||
use \Automattic\WooCommerce\Admin\Features\OnboardingAutomateTaxes;
|
||||
|
@ -63,9 +62,6 @@ class Onboarding {
|
|||
OnboardingTasks::get_instance();
|
||||
}
|
||||
|
||||
// Add onboarding notes.
|
||||
new OnboardingProfiler();
|
||||
|
||||
// Add actions and filters.
|
||||
$this->add_actions();
|
||||
$this->add_filters();
|
||||
|
|
|
@ -472,6 +472,7 @@ class Install {
|
|||
'wc-admin-store-notice-setting-moved',
|
||||
'wc-admin-store-notice-giving-feedback',
|
||||
'wc-admin-learn-more-about-product-settings',
|
||||
'wc-admin-onboarding-profiler-reminder',
|
||||
);
|
||||
|
||||
$additional_obsolete_notes_names = apply_filters(
|
||||
|
|
|
@ -537,27 +537,6 @@ class WC_Admin_Notes_Onboarding_Payments extends DeprecatedClassFacade {
|
|||
protected static $deprecated_in_version = '1.7.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Admin_Notes_Onboarding_Profiler.
|
||||
*
|
||||
* @deprecated since 1.7.0, use OnboardingProfiler
|
||||
*/
|
||||
class WC_Admin_Notes_Onboarding_Profiler extends DeprecatedClassFacade {
|
||||
/**
|
||||
* The name of the non-deprecated class that this facade covers.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\OnboardingProfiler';
|
||||
|
||||
/**
|
||||
* The version that this class was deprecated in.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $deprecated_in_version = '1.7.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Admin_Notes_Online_Clothing_Store.
|
||||
*
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* WooCommerce Admin: Profile reminder note.
|
||||
*
|
||||
* Adds a notes to complete or skip the profiler.
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Notes;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use \Automattic\WooCommerce\Admin\Features\Onboarding;
|
||||
|
||||
/**
|
||||
* Onboarding_Profiler.
|
||||
*/
|
||||
class OnboardingProfiler {
|
||||
/**
|
||||
* Note traits.
|
||||
*/
|
||||
use NoteTraits;
|
||||
|
||||
/**
|
||||
* Name of the note for use in the database.
|
||||
*/
|
||||
const NOTE_NAME = 'wc-admin-onboarding-profiler-reminder';
|
||||
|
||||
/**
|
||||
* Attach hooks.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_init', array( $this, 'possibly_add_note' ) );
|
||||
add_action( 'update_option_' . Onboarding::PROFILE_DATA_OPTION, array( $this, 'update_status_on_complete' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the note.
|
||||
*
|
||||
* @return Note
|
||||
*/
|
||||
public static function get_note() {
|
||||
if ( ! Onboarding::should_show_profiler() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$note = new Note();
|
||||
$note->set_title( __( 'Welcome to WooCommerce! Set up your store and start selling', 'woocommerce-admin' ) );
|
||||
$note->set_content( __( "We're here to help you going through the most important steps to get your store up and running.", 'woocommerce-admin' ) );
|
||||
$note->set_type( Note::E_WC_ADMIN_NOTE_UPDATE );
|
||||
$note->set_name( self::NOTE_NAME );
|
||||
$note->set_content_data( (object) array() );
|
||||
$note->set_source( 'woocommerce-admin' );
|
||||
$note->add_action(
|
||||
'continue-profiler',
|
||||
__( 'Continue Store Setup', 'woocommerce-admin' ),
|
||||
wc_admin_url( '&path=/setup-wizard' ),
|
||||
Note::E_WC_ADMIN_NOTE_UNACTIONED,
|
||||
true
|
||||
);
|
||||
$note->add_action(
|
||||
'skip-profiler',
|
||||
__( 'Skip Setup', 'woocommerce-admin' ),
|
||||
wc_admin_url( '&reset_profiler=0' ),
|
||||
Note::E_WC_ADMIN_NOTE_ACTIONED,
|
||||
false
|
||||
);
|
||||
return $note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the note status when the profiler is completed.
|
||||
*
|
||||
* @param mixed $old_value Old value.
|
||||
* @param mixed $new_value New value.
|
||||
*/
|
||||
public static function update_status_on_complete( $old_value, $new_value ) {
|
||||
if (
|
||||
( isset( $old_value['completed'] ) && $old_value['completed'] ) ||
|
||||
! isset( $new_value['completed'] ) ||
|
||||
! $new_value['completed']
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$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 = Notes::get_note( $note_ids[0] );
|
||||
|
||||
if ( false === $note ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$note->set_status( 'actioned' );
|
||||
$note->save();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue