Skip Navigation
availability:

WooCommerce Multilingual Version: 4.11.0

description:

Allow the overriding of the WCML geolocated country.

type:
filter
category:
Multi-currency Feature
parameters:
$userCountry
(string) Billing address used if set otherwise geolocation country.
$allUserCountries
(array) {

@key $billing
(string) The billing address country
@key $shipping

(string) The shipping address country
@key $geolocation

(string) The geolocation country

}

hook example usage:
// Always use the shipping address if it's available
add_filter( 'wcml_geolocation_get_user_country', function( $userCountry, $allCountries ) {
    return ! empty( $allCountries['shipping'] ) ? $allCountries['shipping'] : $userCountry;
}, 10, 2 );