How To Get Country Name From Country ID In Magento 2

How To Get Country Name From Country ID In Magento 2

Magento 2 is a worldwide platform to run online E-commerce stores. Moreover, Magento 2 stores serve global customers.

Hence, while offering any features in the store, managing the country is essential.

For example, offering a payment method to particular countries. Or allowing the customers a global shipping service.

Implementing such features, you need to display the country name and the below code shows the method to get country name from country ID in Magento 2 store.

Retrieve the full country name from the country ID using the Country class of Directory module. For example, for IN, retrieve India.

Method To Get Country Name From Country ID In Magento 2:

That’s it.

Please use the Comments section below to share your doubts about the topic. I’d be glad to help you out.

Do share the solution with fellow developers via social media.

Thank you.

(based on 12 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a Reply

(based on 5 Reviews)