WHMCS Base URL Template Variable

From WHMCS Documentation

The WHMCS System URL must be defined in all system theme template files for JavaScript AJAX calls to function correctly. It determines the path to the WHMCS directory on your server. WHMCS requires this in order to determine the location of relative resources that the system theme template requires.

If this variable is not defined in your active system theme template, you will see a warning in the browser console:

Warning: The WHMCS Base URL definition is missing from your active template. Please refer to https://docs.whmcs.com/WHMCS_Base_URL_Template_Variable for more information and details of how to resolve this warning.

To resolve this warning, you must add the following to the <head> section of your template:

var whmcsBaseUrl = "{\WHMCS\Utility\Environment\WebHelper::getBaseUrl()}";

It is important that this variable is defined before the templates scripts.min.js file is included.

By default, the Six template defines this parameter within the /includes/head.tpl system theme template file along with a number of other required JavaScript variables.

Visit GitHub for a copy of the latest version of the head.tpl template file for the Six theme, or look in the appropriate directories in your WHMCS installation for Twenty-One.