rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -128,9 +128,6 @@ class OnboardingProducts {
$product_data[ $key ]['description'] = $products[ $product_type['product'] ]->excerpt;
$product_data[ $key ]['more_url'] = $products[ $product_type['product'] ]->link;
$product_data[ $key ]['slug'] = strtolower( preg_replace( '~[^\pL\d]+~u', '-', $products[ $product_type['product'] ]->slug ) );
} elseif ( isset( $product_type['product'] ) ) {
/* translators: site currency symbol (used to show that the product costs money) */
$product_data[ $key ]['label'] .= sprintf( __( ' — %s', 'woocommerce' ), html_entity_decode( get_woocommerce_currency_symbol() ) );
}
}

View File

@@ -22,7 +22,6 @@ class OnboardingProfile {
* Add onboarding actions.
*/
public static function init() {
add_action( 'woocommerce_updated', array( __CLASS__, 'maybe_mark_complete' ) );
add_action( 'update_option_' . self::DATA_OPTION, array( __CLASS__, 'trigger_complete' ), 10, 2 );
}
@@ -65,37 +64,4 @@ class OnboardingProfile {
// https://github.com/woocommerce/woocommerce-admin/pull/2300#discussion_r287237498.
return ! $is_completed && ! $is_skipped;
}
/**
* When updating WooCommerce, mark the profiler and task list complete.
*
* @todo The `maybe_enable_setup_wizard()` method should be revamped on onboarding enable in core.
* See https://github.com/woocommerce/woocommerce/blob/1ca791f8f2325fe2ee0947b9c47e6a4627366374/includes/class-wc-install.php#L341
*/
public static function maybe_mark_complete() {
// The install notice still exists so don't complete the profiler.
if ( ! class_exists( 'WC_Admin_Notices' ) || \WC_Admin_Notices::has_notice( 'install' ) ) {
return;
}
$onboarding_data = get_option( self::DATA_OPTION, array() );
// Don't make updates if the profiler is completed or skipped, but task list is potentially incomplete.
if (
( isset( $onboarding_data['completed'] ) && $onboarding_data['completed'] ) ||
( isset( $onboarding_data['skipped'] ) && $onboarding_data['skipped'] )
) {
return;
}
$onboarding_data['completed'] = true;
update_option( self::DATA_OPTION, $onboarding_data );
if ( ! WCAdminHelper::is_wc_admin_active_for( DAY_IN_SECONDS ) ) {
$task_list = TaskLists::get_list( 'setup' );
if ( ! $task_list ) {
return;
}
$task_list->hide();
}
}
}