Plugin Updates

This commit is contained in:
Tony Volpe
2024-04-02 20:23:21 +00:00
parent 96800520e8
commit 94170ec2c4
1514 changed files with 133309 additions and 105985 deletions

View File

@@ -287,34 +287,34 @@ class WC_Countries {
* @return array
*/
public function get_allowed_countries() {
if ( 'all' === get_option( 'woocommerce_allowed_countries' ) ) {
return apply_filters( 'woocommerce_countries_allowed_countries', $this->countries );
}
$countries = $this->countries;
$allowed_countries = get_option( 'woocommerce_allowed_countries' );
if ( 'all_except' === get_option( 'woocommerce_allowed_countries' ) ) {
if ( 'all_except' === $allowed_countries ) {
$except_countries = get_option( 'woocommerce_all_except_countries', array() );
if ( ! $except_countries ) {
return $this->countries;
} else {
$all_except_countries = $this->countries;
if ( $except_countries ) {
foreach ( $except_countries as $country ) {
unset( $all_except_countries[ $country ] );
unset( $countries[ $country ] );
}
}
} elseif ( 'specific' === $allowed_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', $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 ];
}
}
/**
* Filter the list of allowed selling countries.
*
* @since 3.3.0
* @param array $countries
*/
return apply_filters( 'woocommerce_countries_allowed_countries', $countries );
}
@@ -324,24 +324,34 @@ class WC_Countries {
* @return array
*/
public function get_shipping_countries() {
if ( '' === get_option( 'woocommerce_ship_to_countries' ) ) {
return $this->get_allowed_countries();
// If shipping is disabled, return an empty array.
if ( 'disabled' === get_option( 'woocommerce_ship_to_countries' ) ) {
return array();
}
// Default to selling countries.
$countries = $this->get_allowed_countries();
// All indicates that all countries are allowed, regardless of where you sell to.
if ( 'all' === get_option( 'woocommerce_ship_to_countries' ) ) {
return $this->countries;
}
$countries = $this->countries;
} elseif ( 'specific' === get_option( 'woocommerce_ship_to_countries' ) ) {
$countries = array();
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries', array() );
$countries = array();
$raw_countries = get_option( 'woocommerce_specific_ship_to_countries' );
if ( $raw_countries ) {
foreach ( $raw_countries as $country ) {
$countries[ $country ] = $this->countries[ $country ];
if ( $raw_countries ) {
foreach ( $raw_countries as $country ) {
$countries[ $country ] = $this->countries[ $country ];
}
}
}
/**
* Filter the list of allowed selling countries.
*
* @since 3.3.0
* @param array $countries
*/
return apply_filters( 'woocommerce_countries_shipping_countries', $countries );
}
@@ -859,7 +869,7 @@ class WC_Countries {
),
),
'AL' => array(
'state' => array(
'state' => array(
'label' => __( 'County', 'woocommerce' ),
),
),
@@ -968,7 +978,7 @@ class WC_Countries {
'required' => false,
'hidden' => true,
),
'state' => array(
'state' => array(
'required' => false,
),
),
@@ -1011,7 +1021,7 @@ class WC_Countries {
'postcode' => array(
'required' => false,
),
'state' => array(
'state' => array(
'label' => __( 'Department', 'woocommerce' ),
),
),
@@ -1054,12 +1064,12 @@ class WC_Countries {
),
),
'DO' => array(
'state' => array(
'state' => array(
'label' => __( 'Province', 'woocommerce' ),
),
),
'EC' => array(
'state' => array(
'state' => array(
'label' => __( 'Province', 'woocommerce' ),
),
),
@@ -1097,11 +1107,11 @@ class WC_Countries {
),
),
'GG' => array(
'state' => array(
'required' => false,
'label' => __( 'Parish', 'woocommerce' ),
),
),
'state' => array(
'required' => false,
'label' => __( 'Parish', 'woocommerce' ),
),
),
'GH' => array(
'postcode' => array(
'required' => false,
@@ -1147,7 +1157,7 @@ class WC_Countries {
),
),
'HN' => array(
'state' => array(
'state' => array(
'label' => __( 'Department', 'woocommerce' ),
),
),
@@ -1350,7 +1360,7 @@ class WC_Countries {
),
),
'NI' => array(
'state' => array(
'state' => array(
'label' => __( 'Department', 'woocommerce' ),
),
),
@@ -1400,7 +1410,7 @@ class WC_Countries {
),
),
'PA' => array(
'state' => array(
'state' => array(
'label' => __( 'Province', 'woocommerce' ),
),
),
@@ -1430,7 +1440,7 @@ class WC_Countries {
),
'PY' => array(
'state' => array(
'label' => __( 'Department', 'woocommerce' ),
'label' => __( 'Department', 'woocommerce' ),
),
),
'RE' => array(
@@ -1497,7 +1507,7 @@ class WC_Countries {
),
),
'SV' => array(
'state' => array(
'state' => array(
'label' => __( 'Department', 'woocommerce' ),
),
),
@@ -1575,7 +1585,7 @@ class WC_Countries {
),
),
'UY' => array(
'state' => array(
'state' => array(
'label' => __( 'Department', 'woocommerce' ),
),
),