Get country name from country code in magento

When dealing with magento customization sometimes we need to get country name from country code. Its pretty easy to do so with a single line of code

Magento has a model to manage the countries which is directory/country

So first we need to load the model with the desired country code as shown below

<?php
echo Mage::getModel("directory/country")->load('in')->getName();
?>

Hope this helps to get country name from country code in magento

Leave a Reply

Your email address will not be published. Required fields are marked *