WC_Countries::get_shipping_country_states
Get shipping country states.
Method of the class: WC_Countries{}
Hooks from the method
Returns
Array.
Usage
$WC_Countries = new WC_Countries(); $WC_Countries->get_shipping_country_states();
WC_Countries::get_shipping_country_states() WC Countries::get shipping country states code WC 10.6.2
public function get_shipping_country_states() {
if ( get_option( 'woocommerce_ship_to_countries' ) === '' ) {
return $this->get_allowed_country_states();
}
if ( get_option( 'woocommerce_ship_to_countries' ) !== 'specific' ) {
return $this->states;
}
$states = array();
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries' );
if ( $raw_countries ) {
foreach ( $raw_countries as $country ) {
if ( ! empty( $this->states[ $country ] ) ) {
$states[ $country ] = $this->states[ $country ];
}
}
}
return apply_filters( 'woocommerce_countries_shipping_country_states', $states );
}