Automattic\WooCommerce\Internal\Admin
WcPayWelcomePage::has_incentive
Check if we have an incentive available to show.
Метод класса: WcPayWelcomePage{}
Хуки из метода
Возвращает
true|false. Whether we have an incentive available to show.
Использование
$WcPayWelcomePage = new WcPayWelcomePage(); $WcPayWelcomePage->has_incentive( $skip_wcpay_active ): bool;
- $skip_wcpay_active(true|false)
- Whether to skip the check for the WooPayments plugin being active.
По умолчанию: false
Код WcPayWelcomePage::has_incentive() WcPayWelcomePage::has incentive WC 10.4.3
public function has_incentive( bool $skip_wcpay_active = false ): bool {
// The WooPayments plugin must not be active.
if ( ! $skip_wcpay_active && $this->is_wcpay_active() ) {
return false;
}
// Suggestions not disabled via a setting.
if ( get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) === 'no' ) {
return false;
}
/**
* Filter allow marketplace suggestions.
*
* User can disable all suggestions via filter.
*
* @since 3.6.0
*/
if ( ! apply_filters( 'woocommerce_allow_marketplace_suggestions', true ) ) {
return false;
}
$incentive = $this->get_incentive();
if ( empty( $incentive ) ) {
return false;
}
if ( $this->is_incentive_dismissed( $incentive ) ) {
return false;
}
return $this->suggestion_incentives->is_incentive_visible(
$incentive['id'],
PaymentsExtensionSuggestions::WOOPAYMENTS,
WC()->countries->get_base_country(),
$skip_wcpay_active
);
}