Customising Countries and Calling Codes

From WHMCS Documentation

Revision as of 16:23, 13 June 2016 by Matt (talk | contribs) (Customising Countries)

This documentation page applies to a future as yet unpublished version of WHMCS.

What are the Countries?

The countries file defines the countries shown within WHMCS and their respective calling codes.

Customising Countries

The country definitions shipped with WHMCS by default can be found in resources/country/dist.countries.json. This file should not be edited.

Prior to WHMCS 7.0, this file was located at /includes/countries.php in a different format

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

Adding a Country

Inside your /resources/country/countries.json file, add a section as follows:

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

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

Modifying a Country

Inside your /resources/country/countries.json file, add a section as follows:

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

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

Removing a Country

Inside your /resources/country/countries.json file, add a section as follows:

{
    "GB": false
}

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

Troubleshooting

If after making an edit to your custom /resources/country/countries.json file, it does not take effect, this indicates that the file contains invalid syntax.

The file must contain valid JSON Syntax. Running the contents of your file through an online syntax validation checker such as http://www.jsonlint.com/ should help pinpoint the issue.