Automattic\WooCommerce\Internal\Admin

WcPayWelcomePage::is_incentive_dismissed()privateWC 1.0

Check if the current incentive has been manually dismissed.

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

Хуков нет.

Возвращает

true|false.

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

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

Код WcPayWelcomePage::is_incentive_dismissed() WC 9.3.3

private function is_incentive_dismissed(): bool {
	$dismissed_incentives = get_option( 'wcpay_welcome_page_incentives_dismissed', [] );

	// If there are no dismissed incentives, return early.
	if ( empty( $dismissed_incentives ) ) {
		return false;
	}

	// Return early if there is no eligible incentive.
	$incentive = $this->get_incentive();
	if ( empty( $incentive ) ) {
		return true;
	}

	// Search the incentive ID in the dismissed incentives list.
	if ( in_array( $incentive['id'], $dismissed_incentives, true ) ) {
		return true;
	}

	return false;
}