Magento2 – How to Get Country Name Using Country Code

Magento2 – How to Get Country Name Using Country Code
()

Create Instance to Object Manager then inject dependency to perform your query: $objectManager = \Magento\Framework\App\ObjectManager::getInstance();

Now load your country by the following code:

 $country = $objectManager->create('\Magento\Directory\Model\Country')->load('AE')->getName();</pre>

While AE is the country code. The output of above code will be: United Arab Emirates

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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