Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
WooPayments::is_onboarding_supported
Check if the payment gateway supports the current store state for onboarding.
Most of the time the current business location should be the main factor, but could also consider other store settings like currency.
Method of the class: WooPayments{}
No Hooks.
Returns
true|false|null. True if the payment gateway supports onboarding, false otherwise. If the payment gateway does not provide the information, we will return null to indicate that we don't know.
Usage
$WooPayments = new WooPayments(); $WooPayments->is_onboarding_supported( $payment_gateway, $country_code ): ?bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
- $country_code(string)
- The country code for which to check. This should be an ISO 3166-1 alpha-2 country code.
Default:''
WooPayments::is_onboarding_supported() WooPayments::is onboarding supported code WC 10.9.4
public function is_onboarding_supported( WC_Payment_Gateway $payment_gateway, string $country_code = '' ): ?bool {
$is_onboarding_supported = parent::is_onboarding_supported( $payment_gateway, $country_code );
if ( ! is_null( $is_onboarding_supported ) ) {
return $is_onboarding_supported;
}
// Without a country code to check against, we assume onboarding is supported to avoid blocking the user.
if ( empty( $country_code ) ) {
return true;
}
// Normalize the country code.
$country_code = strtoupper( $country_code );
// The payment gateway didn't provide the information. We will do it the hard way.
$supported_country_codes = $this->get_supported_country_codes();
// If we can't get the supported countries, we assume onboarding supported to avoid blocking the user.
if ( is_null( $supported_country_codes ) ) {
return true;
}
return in_array( $country_code, $supported_country_codes, true );
}