WC_Countries::country_exists
Check if a given code represents a valid ISO 3166-1 alpha-2 code for a country known to us.
Method of the class: WC_Countries{}
No Hooks.
Returns
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. |
WC_Countries::country_exists() WC Countries::country exists code WC 10.6.2
public function country_exists( $country_code ) {
return isset( $this->get_countries()[ $country_code ] );
}