WC_Countries::country_exists()publicWC 5.1.0

Check if a given code represents a valid ISO 3166-1 alpha-2 code for a country known to us.

{} It's a method of the class: WC_Countries{}

No Hooks.


true|false. True if the country is known to us, false otherwise.


$WC_Countries = new WC_Countries();
$WC_Countries->country_exists( $country_code );
$country_code(string) (required)
The country code to check as a ISO 3166-1 alpha-2 code.


Since 5.1.0 Introduced.

Code of WC_Countries::country_exists() WC 6.7.0

public function country_exists( $country_code ) {
	return isset( $this->get_countries()[ $country_code ] );