Automattic\WooCommerce\StoreApi\Utilities
OrderController::validate_allowed_country
Check all required address fields are set and return errors if not.
Method of the class: OrderController{}
No Hooks.
Returns
true|false. True if valid.
Usage
// protected - for code of main (parent) or child class $result = $this->validate_allowed_country( $country, $allowed_countries );
- $country(string) (required)
- Country code.
- $allowed_countries(array) (required)
- List of valid country codes.
OrderController::validate_allowed_country() OrderController::validate allowed country code WC 10.8.1
protected function validate_allowed_country( $country, array $allowed_countries ) {
return array_key_exists( $country, $allowed_countries );
}