WordPress at Your Fingertips
function is not described

WC_Countries::country_exists() public WC 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.

Return

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

Usage

$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.

Changelog

Since 5.1.0 Introduced.

Code of WC_Countries::country_exists() WC 5.6.0

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