I am getting data of country code
and ID
and name
from
Magento\Directory\Api\CountryInformationAcquirerInterface
using getCountriesInfo
function.
Like this
{
"id": "EG",
"two_letter_abbreviation": "EG",
"three_letter_abbreviation": "EGY",
"full_name_locale": "Egypt",
"full_name_english": "Egypt"
},
{
"id": "KP",
"two_letter_abbreviation": "KP",
"three_letter_abbreviation": "PRK",
"full_name_locale": "North Korea",
"full_name_english": "North Korea"
},
{
"id": "KW",
"two_letter_abbreviation": "KW",
"three_letter_abbreviation": "KWT",
"full_name_locale": "Kuwait",
"full_name_english": "Kuwait"
},
How can I get telephone code of that country as well in Magento 2 ?
like
Egypt telephone code +20
Kuwait telephone code +965
Best Answer
You can create function in helper by enter all dial number with country code. I have created function like below:
You can get in phtml file like following:
Hope it will work.