WC_Countries::get_states()publicWC 1.0

Get the states for a country.

Method of the class: WC_Countries{}

Hooks from the method

Return

false|Array. of states

Usage

$WC_Countries = new WC_Countries();
$WC_Countries->get_states( $cc );
$cc(string)
Country code.
Default: null

WC_Countries::get_states() code WC 8.0.2

public function get_states( $cc = null ) {
	if ( ! isset( $this->geo_cache['states'] ) ) {
		/**
		 * Allows filtering of country states in WC.
		 *
		 * @since 1.5.3
		 *
		 * @param array $states
		 */
		$this->geo_cache['states'] = apply_filters( 'woocommerce_states', include WC()->plugin_path() . '/i18n/states.php' );
	}

	if ( ! is_null( $cc ) ) {
		return isset( $this->geo_cache['states'][ $cc ] ) ? $this->geo_cache['states'][ $cc ] : false;
	} else {
		return $this->geo_cache['states'];
	}
}