Add check of $raw_countries before the foreach in WC_Countries
This commit is contained in:
parent
1f2cda5a49
commit
0a2c0af5ff
|
@ -231,9 +231,11 @@ class WC_Countries {
|
||||||
|
|
||||||
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries' );
|
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries' );
|
||||||
|
|
||||||
|
if ( $raw_countries ) {
|
||||||
foreach ( $raw_countries as $country ) {
|
foreach ( $raw_countries as $country ) {
|
||||||
$countries[ $country ] = $this->countries[ $country ];
|
$countries[ $country ] = $this->countries[ $country ];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_countries_shipping_countries', $countries );
|
return apply_filters( 'woocommerce_countries_shipping_countries', $countries );
|
||||||
}
|
}
|
||||||
|
@ -251,11 +253,13 @@ class WC_Countries {
|
||||||
|
|
||||||
$raw_countries = get_option( 'woocommerce_specific_allowed_countries' );
|
$raw_countries = get_option( 'woocommerce_specific_allowed_countries' );
|
||||||
|
|
||||||
|
if ( $raw_countries ) {
|
||||||
foreach ( $raw_countries as $country ) {
|
foreach ( $raw_countries as $country ) {
|
||||||
if ( isset( $this->states[ $country ] ) ) {
|
if ( isset( $this->states[ $country ] ) ) {
|
||||||
$states[ $country ] = $this->states[ $country ];
|
$states[ $country ] = $this->states[ $country ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_countries_allowed_country_states', $states );
|
return apply_filters( 'woocommerce_countries_allowed_country_states', $states );
|
||||||
}
|
}
|
||||||
|
@ -277,11 +281,13 @@ class WC_Countries {
|
||||||
|
|
||||||
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries' );
|
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries' );
|
||||||
|
|
||||||
|
if ( $raw_countries ) {
|
||||||
foreach ( $raw_countries as $country ) {
|
foreach ( $raw_countries as $country ) {
|
||||||
if ( ! empty( $this->states[ $country ] ) ) {
|
if ( ! empty( $this->states[ $country ] ) ) {
|
||||||
$states[ $country ] = $this->states[ $country ];
|
$states[ $country ] = $this->states[ $country ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_countries_shipping_country_states', $states );
|
return apply_filters( 'woocommerce_countries_shipping_country_states', $states );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue