WC_Countries::get_allowed_countries()
Get countries that the store sells to.
Метод класса: WC_Countries{}
Хуки из метода
Возвращает
Массив
.
Использование
$WC_Countries = new WC_Countries(); $WC_Countries->get_allowed_countries();
Код WC_Countries::get_allowed_countries() WC Countries::get allowed countries WC 7.3.0
public function get_allowed_countries() { if ( 'all' === get_option( 'woocommerce_allowed_countries' ) ) { return apply_filters( 'woocommerce_countries_allowed_countries', $this->countries ); } if ( 'all_except' === get_option( 'woocommerce_allowed_countries' ) ) { $except_countries = get_option( 'woocommerce_all_except_countries', array() ); if ( ! $except_countries ) { return $this->countries; } else { $all_except_countries = $this->countries; foreach ( $except_countries as $country ) { unset( $all_except_countries[ $country ] ); } return apply_filters( 'woocommerce_countries_allowed_countries', $all_except_countries ); } } $countries = array(); $raw_countries = get_option( 'woocommerce_specific_allowed_countries', array() ); if ( $raw_countries ) { foreach ( $raw_countries as $country ) { $countries[ $country ] = $this->countries[ $country ]; } } return apply_filters( 'woocommerce_countries_allowed_countries', $countries ); }