Additional Domain Fields

From WHMCS Documentation

This page describes a feature available in version 7.0 and above

What are additional domain fields?

Additional domain fields (also commonly referred to as Extended Attributes) define the information required by domain registries for a given TLD.

When a domain registry requires the information, a domain name will fail to register successfully unless the values are provided.

Typical information requested by domain registries include things such as Registrant Legal Type, Registered Entity Name, etc...

When are the fields asked for?

Domain fields are displayed as part of the order process.

In the shopping cart they will appear during the Domains Configuration step.

If a field is required, customers will be required to provide the requested information before moving to the next step.

The values provided to these fields are then saved and submitted to the domain registrar when the domain is registered.

How do I customise the fields that are displayed?

The default field definitions that we ship with WHMCS can be found in /resources/domains/dist.additionalfields.php This file should not be edited.

Prior to WHMCS 7.0, this file was located at /includes/additionaldomainfields.php

To customise the fields, create a new file named additionalfields.php within the /resources/domains/ directory.

Adding a New Field

  1. Add a new entry into your custom /resources/domains/additionalfields.php file
  2. You can use the field formatting as found in the /resources/domains/dist.additionalfields.php file as a reference
$additionaldomainfields[""][] = array(
    "Name" => "Date of Birth",
    "Type" => "text",
    "Size" => "30",

Editing an Existing Field

  1. Begin by copying and pasting the field definition from the /resources/domains/dist.additionalfields.php file into your custom /resources/domains/additionalfields.php file
  2. Remove any key/value pairs for parameters you do not wish to customise
  3. Customise the remaining options as desired (in the example below the option values are being customised to just the 3 most commonly used options)
  4. Options can have a Display Name defined by adding the "|" symbol followed by the desired display name - e.g., "1|Individual"
$additionaldomainfields[""][] = array(
    "Name" => "Legal Type",
    "Options" => "1|Individual,2|UK Limited Company,3|UK Public Limited Company",

Removing an Existing Field

  1. Define the field within your custom /resources/domains/additionalfields.php file and set the Remove attribute to TRUE
$additionaldomainfields[""][] = array(
    "Name" => "Company ID Number",
    "Remove" => true,

Translating a Field Name

  1. Define the field within your custom /resources/domains/additionalfields.php file and set the LangVar attribute to the desired language variable
  2. Add the translation string with the corresponding attribute to your language override file
$additionaldomainfields[""][] = array(
    "Name" => "Legal Type",
    "Options" => "Individual,UK Limited Company,UK Public Limited Company",
    "LangVar" => "uktldlegaltype",

Language override file entry:

$_LANG['uktldlegaltype'] = "Custom Field Label Text";

The field name can be translated via language override files. This allows you to change the label displayed on the shopping cart next to the additional domain field based upon the language in which the visitor is viewing your site.

Prepopulated Data Variables

The following variables are available for use with dropdown field types.

{Countries}Provides a comma separated list of countries. A full country name will be saved and passed to the registrar for the field (eg. United Kingdom).
{CountryCodeMap}Provides an associative key value pair list of country codes and country names. This will display the full country name for a user to select from but only store and pass the ISO country code to the registrar (eg. GB).

Example Usage

$additionaldomainfields[""][] = array(
    "Name" => "Registered Country",
    "Type" => "dropdown",
    "Options" => "{Countries}",