Additional Domain Fields

From WHMCS Documentation

Revision as of 22:54, 22 July 2016 by Cole (talk | contribs)

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[".co.uk"][] = 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)
$additionaldomainfields[".co.uk"][] = array(
    "Name" => "Legal Type",
    "Options" => "Individual,UK Limited Company,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[".co.uk"][] = array(
    "Name" => "Company ID Number",
    "Remove" => true,
);

Prepopulated Data Variables

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

TagDescription
{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[".co.uk"][] = array(
    "Name" => "Registered Country",
    "Type" => "dropdown",
    "Options" => "{Countries}",
);