1

How can I get the country short code (ISO) of the billing address of a logged in customer. Can anyone help? Thanks!

  • Have you found a solution for this problem? – sv3n Jul 25 '17 at 10:53
  • @sv3N Not yet, unfortunately. My observer is observing is basically working now, thanks to your help on the other issue link. My final goal is to display the right currency to a logged in customer (B2B Shop). The currency refers to the default billing address country and its official currency. That does not work yet. I would appreciate any hint. – Self Diagnostics Jul 25 '17 at 13:56
  • I've read your other question ... I'm setting up a new multistore system at the moment, so I'll require this too. Guess it will take one or two days, to get a solution - have to finish other stuff first. – sv3n Jul 25 '17 at 13:59
  • Feel free to share your findings ;-) – Self Diagnostics Jul 25 '17 at 14:41
1

You can try this:

$session = Mage::getSingleton('customer/session');
if ($session->isLoggedIn()) {
    $countryCode = $session->getCustomer()->getDefaultBillingAddress()->getCountry();
}
  • How to get full country name instead of a country code, here is my code return only country code: pastiebin.com/5ce2558df3370 @sv3n – Gem May 20 '19 at 7:22
0

Try like this

$customerAddress->getCountryModel()->getName()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.