Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives
WooPayments::is_visible
Check if an incentive should be visible.
Method of the class: WooPayments{}
No Hooks.
Returns
true|false. Whether the incentive should be visible.
Usage
$WooPayments = new WooPayments(); $WooPayments->is_visible( $id, $country_code, $skip_extension_active_check ): bool;
- $id(string) (required)
- The incentive ID to check for visibility.
- $country_code(string) (required)
- 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.
Default: false
WooPayments::is_visible() WooPayments::is visible code WC 10.3.3
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;
}