Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives
Incentive::is_visible()
Check if an incentive should be visible.
Метод класса: Incentive{}
Хуков нет.
Возвращает
true|false
. Whether the incentive should be visible.
Использование
$Incentive = new Incentive(); $Incentive->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
Код Incentive::is_visible() Incentive::is visible WC 9.6.1
public function is_visible( string $id, string $country_code, bool $skip_extension_active_check = false ): bool { // The extension plugin must not be active, unless we are asked to skip the check. if ( ! $skip_extension_active_check && $this->is_extension_active() ) { return false; } // The current WP user must have the required capabilities. if ( ! $this->user_has_caps() ) { return false; } // An incentive must be available. if ( empty( $this->get_by_id( $id, $country_code ) ) ) { return false; } // If the incentive has been dismissed in all contexts, don't show it. // We don't know the full list of contexts, so we can't assume anything beyond `all`. if ( $this->is_dismissed( $id, 'all' ) ) { return false; } return true; }