Automattic\WooCommerce\Internal\Admin\Onboarding

OnboardingProfile::maybe_mark_complete()public staticWC 1.0

When updating WooCommerce, mark the profiler and task list complete.

{} Это метод класса: OnboardingProfile{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = OnboardingProfile::maybe_mark_complete();

Код OnboardingProfile::maybe_mark_complete() WC 6.6.1

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();
	}
}