Automattic\WooCommerce\Internal\Admin

WcPayWelcomePage::is_incentive_dismissed()privateWC 1.0

Check if the current incentive has been manually dismissed.

Method of the class: WcPayWelcomePage{}

No Hooks.

Return

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->is_incentive_dismissed(): bool;

WcPayWelcomePage::is_incentive_dismissed() code 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;
}