WPML
PHP
wcml_geolocation_get_user_country

Descrição

Permitir sobrescrever o país geolocalizado do WCML.

Argumentos

  • $userCountrystring

    Endereço de faturamento usado se definido; caso contrário, o país de geolocalização.
  • $allUserCountriesarray

    {

Exemplo de uso

PHP
// 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 );