Fix Woo.com reference in the Inbox during onboarding (#46600)
* Fix: Woo.com Reference in the Inbox During Onboarding * add changelog file * fix linting error
This commit is contained in:
parent
466b3a8d06
commit
c973ff93c0
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix Woo.com reference in the inbox during onboarding.
|
|
@ -250,6 +250,7 @@ class WC_Install {
|
|||
),
|
||||
'8.9.0' => array(
|
||||
'wc_update_890_add_launch_your_store_tour_option',
|
||||
'wc_update_890_update_connect_to_woocommerce_note',
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -18,8 +18,11 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Notes\Note;
|
||||
use Automattic\WooCommerce\Admin\Notes\Notes;
|
||||
use Automattic\WooCommerce\Database\Migrations\MigrationHelper;
|
||||
use Automattic\WooCommerce\Internal\Admin\Marketing\MarketingSpecs;
|
||||
use Automattic\WooCommerce\Internal\Admin\Notes\WooSubscriptionsNotes;
|
||||
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\DataSynchronizer;
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore;
|
||||
|
@ -2673,3 +2676,22 @@ function wc_update_870_prevent_listing_of_transient_files_directory() {
|
|||
function wc_update_890_add_launch_your_store_tour_option() {
|
||||
update_option( 'woocommerce_show_lys_tour', 'yes' );
|
||||
}
|
||||
|
||||
/**
|
||||
* If it exists, remove and recreate the inbox note that asks users to connect to `Woo.com` so that the domain name is changed to the updated `WooCommerce.com`.
|
||||
*/
|
||||
function wc_update_890_update_connect_to_woocommerce_note() {
|
||||
$note = Notes::get_note_by_name( WooSubscriptionsNotes::CONNECTION_NOTE_NAME );
|
||||
if ( ! is_a( $note, 'Automattic\WooCommerce\Admin\Notes\Note' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( ! str_contains( $note->get_title(), 'Woo.com' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( $note->get_status() !== Note::E_WC_ADMIN_NOTE_SNOOZED && $note->get_status() !== Note::E_WC_ADMIN_NOTE_UNACTIONED ) {
|
||||
return;
|
||||
}
|
||||
Notes::delete_notes_with_name( WooSubscriptionsNotes::CONNECTION_NOTE_NAME );
|
||||
$new_note = WooSubscriptionsNotes::get_note();
|
||||
$new_note->save();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue