Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives

WooPayments::has_wcpay_account_data │ private │ WC 1.0

Check if there is meaningful live account data in the WooPayments account cache.

Sandbox accounts don't count: a test-drive account is a trial of WooPayments, not actual use of it. This mirrors how WooPayments itself decides whether an account belongs to a genuine live merchant (see WC_Payments_Account::maybe_record_kyc_completion_date()).

Метод класса: WooPayments{}

Хуков нет.

Возвращает

boolean.

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

// private - только в коде основоного (родительского) класса
$result = $this->has_wcpay_account_data(): bool;

Код WooPayments::has_wcpay_account_data() WC 11.3.0

private function has_wcpay_account_data(): bool {
	$account_data = get_option( 'wcpay_account_data', array() );
	$account      = $account_data['data'] ?? array();

	if ( empty( $account['account_id'] ) ) {
		return false;
	}

	// A test-drive account is a trial of WooPayments, not real usage of it.
	if ( ! empty( $account['is_test_drive'] ) ) {
		return false;
	}

	// Sandbox accounts don't count either.
	// Both flags are only acted upon when present: cached account data written by
	// older WooPayments versions may not carry them, and we'd rather keep counting
	// those stores as WooPayments users than reclassify them on missing data.
	if ( isset( $account['is_live'] ) && ! $account['is_live'] ) {
		return false;
	}

	return true;
}