function fetchUserCountry() { // Get country saved in user preferences. $country = eZShopFunctions::getPreferredUserCountry(); if ( !$country ) { // If not found, get country from user object // and save it to the preference. $country = eZShopFunctions::getUserCountry(); if ( $country ) eZShopFunctions::setPreferredUserCountry( $country ); } return array( 'result' => $country ); }