Countries and Calling Codes

The countries.json file determines the countries that appear in WHMCS and their respective calling codes. Primarily, WHMCS uses this data to determine the contents of the country menu choices for addresses and country call or area codes.

This data only has a limited affect on automatic phone number formatting.

Customize Countries

WHMCS’s default country definitions ship in the resources/country/dist.countries.json file.

Do not edit the resources/country/dist.countries.json file.

To customize the list of countries, begin by creating a custom countries.json file in the /resources/country/ directory.

ISO-3116 Countries

If you add non-ISO-3166 countries, WHMCS adds them to:

  • The country menu selections for addresses.
  • The country codes used for backend phone parsing.
  • The repository that automatic phone number formatting uses to format phone numbers.

Removing or changing a country or calling code will not alter the default ISO-3166 repository that WHMCS uses for automatic phone number formatting. You can only change or remove the address country menu choices and the backend phone number formatting logic that WHMCS transmits to external service providers like registrars or gateways.

Add a Country

Inside your custom /resources/country/countries.json file, add a section that resembles this example:

{
    "ABC": {
        "name": "Awesome Best Country",
        "callingCode": 12345
    }
}

This will add a country with the display name Awesome Best Country.

Modify a Country

Inside your custom /resources/country/countries.json file, add a section that resembles this example:

{
    "GB": {
        "name": "Great Britain",
        "callingCode": 44
    }
}

The above example would customise the display name for United Kingdom (GB) to Great Britain.

Remove a Country

Inside your custom /resources/country/countries.json file, add a section that resembles this example:

{
    "GB": false
}

The above example would remove GB (United Kingdom) from the available countries within WHMCS.

Last modified: October 29, 2024