Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives

WooPayments::is_visible()publicWC 1.0

Check if an incentive should be visible.

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

Хуков нет.

Возвращает

true|false. Whether the incentive should be visible.

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

$WooPayments = new WooPayments();
$WooPayments->is_visible( $id, $country_code, $skip_extension_active_check ): bool;
$id(строка) (обязательный)
The incentive ID to check for visibility.
$country_code(строка) (обязательный)
The business location country code to get incentives for.
$skip_extension_active_check(true|false)
Whether to skip the check for the extension plugin being active.
По умолчанию: false

Код WooPayments::is_visible() WC 9.6.1

public function is_visible( string $id, string $country_code, bool $skip_extension_active_check = false ): bool {
	// Always skip the extension active check since we will check bellow.
	if ( false === parent::is_visible( $id, $country_code, true ) ) {
		return false;
	}

	// Instead of just extension active, we check if WooPayments is active and has an account.
	if ( ! $skip_extension_active_check && $this->is_extension_active() && $this->has_wcpay_account_data() ) {
		return false;
	}

	return true;
}