Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
Payments::is_woopayments_supported_country
Check if the store is in a WooPayments-supported geography.
Method of the class: Payments{}
No Hooks.
Returns
true|false. Whether the country is supported by WooPayments.
Usage
// private - for code of main (parent) class only $result = $this->is_woopayments_supported_country( $country_code ): bool;
- $country_code(string) (required)
- Country code to check. If not provided, uses store base country.
Payments::is_woopayments_supported_country() Payments::is woopayments supported country code WC 10.8.1
private function is_woopayments_supported_country( string $country_code ): bool {
if ( class_exists( '\WC_Payments_Utils' ) && is_callable( array( '\WC_Payments_Utils', 'supported_countries' ) ) ) {
$supported_countries = array_keys( \WC_Payments_Utils::supported_countries() );
return in_array( $country_code, $supported_countries, true );
}
// WooPayments is not installed and active, use core's list of supported countries.
$supported_countries = DefaultPaymentGateways::get_wcpay_countries();
return in_array( $country_code, $supported_countries, true );
}