Automattic\WooCommerce\StoreApi\Utilities

ValidationUtils::get_states_for_countrypublicWC 1.0

Get list of states for a country.

Method of the class: ValidationUtils{}

No Hooks.

Returns

Array. Array of state names indexed by state keys.

Usage

$ValidationUtils = new ValidationUtils();
$ValidationUtils->get_states_for_country( $country );
$country(string) (required)
Country code.

ValidationUtils::get_states_for_country() code WC 10.7.0

public function get_states_for_country( $country ) {
	return $country ? array_filter( (array) \wc()->countries->get_states( $country ) ) : [];
}