Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments

WooPaymentsService::mark_onboarding_step_startedpublicWC 1.0

Mark an onboarding step as started.

Method of the class: WooPaymentsService{}

No Hooks.

Returns

true|false. Whether the onboarding step was marked as started.

Usage

$WooPaymentsService = new WooPaymentsService();
$WooPaymentsService->mark_onboarding_step_started( $step_id, $location, $overwrite, ?string $source ): bool;
$step_id(string) (required)
The ID of the onboarding step.
$location(string) (required)
The location for which we are onboarding. This is an ISO 3166-1 alpha-2 country code.
$overwrite(true|false)
Whether to overwrite the step status if it is already started and update the timestamp.
Default: false
?string $source
.
Default: self::SESSION_ENTRY_DEFAULT

WooPaymentsService::mark_onboarding_step_started() code WC 10.7.0

public function mark_onboarding_step_started( string $step_id, string $location, bool $overwrite = false, ?string $source = self::SESSION_ENTRY_DEFAULT ): bool {
	$this->check_if_onboarding_step_action_is_acceptable( $step_id, $location );

	// Clear possible failed status for the step.
	$this->clear_onboarding_step_failed( $step_id, $location );

	$statuses = (array) $this->get_nox_profile_onboarding_step_entry( $step_id, $location, 'statuses' );
	if ( ! $overwrite && ! empty( $statuses[ self::ONBOARDING_STEP_STATUS_STARTED ] ) ) {
		return true;
	}

	// Mark the step as started and record the timestamp.
	$statuses[ self::ONBOARDING_STEP_STATUS_STARTED ] = $this->proxy->call_function( 'time' );

	// Store the updated step data.
	$result = $this->save_nox_profile_onboarding_step_entry( $step_id, $location, 'statuses', $statuses );

	if ( $result ) {
		$source = $this->validate_onboarding_source( $source );

		// Record an event for the step being started.
		$this->record_event(
			self::EVENT_PREFIX . 'onboarding_step_started',
			$location,
			array(
				'step_id' => $step_id,
				'source'  => $source,
			)
		);
	}

	return $result;
}