WHMCS V 8.10 sell service with a customer existing Subdomain

 

WHMCS is a website software package that sells IT services.

https://www.whmcs.com

We use this software to support our online and hosting service in China.

https://webtest.accesstochina.com

From time to time, we find we need to add features to the WHMCS software to enable us to sell services or information not currently supported by the WHMCS " out-of-the-box” software.

The good news is that WHMCS has many development tools to support making changes as required.

Below are my notes on how to allow services to be sold with a customer's existing subdomain.

I assume you understand the WHMCS development manual, PHP, PHP templates (TPL) and WHCS hooks.

Background

When selling a service, you often add a domain name; e.g., cloud VPS service typically requires a domain/subdomain to locate the service. Example of a domain sold with a service;

 whmcs example1 800

 

WHMCS supports the following domain sources;

    • New domain purchased from ISP with WHMCS have many integrated suppliers
    • Domain you have already purchased
    • Domain transferred into your ISP domain supplier account
    • Customers own domain
    • Subdomain to one existing domain, e.g., customer-sub-domain.b2b66.icu (b2b66.icu is a domain own my business). It is not a subdomain owned by the customer's domain.

 

WHMCS currently does not support customers using their subdomain.

Changes needed WHMCS

Four files need creating/changing.

    • Based on using WHMCS standard template:
      • twenty-one -> orderform -> configureproductdomain.tpl
    • javascript
      • twenty-one -> orderform -> standard_cart -> js -> scripts.min.js
    • Two new hooks
      • ShoppingCartValidateDomain
      • ShoppingCartViewCartOutput

Recommended steps

Please note that these are the steps I took to make changes. I am publishing them as a guide, and they should be tested in a backup development system. Each install of WHMCS can be different based on the version and modules installed.  

If you do not have development services, I recommend not installing these changes in your production system. You can request a development license key from WHMCS, create a copy of your production system, and check they work in your service environment.

1. Create a complete backup of your WHMCS system

2. Make a copy of the twenty-one orderform start_cart directory

    • templates/orderforms/standart_cart -> templates/orderforms/standard_cart2
    • In WHMCS system setting -> general settings -> ordering (tab) select new template name (in this case, standard_cart2). In doing this, you can return to the original template if needed)

3. Create a new field in the template configureproductdomain.tpl for the subdomain;

whmcs example2 800

 

    • Search the template for “{if $owndomainenabled}”. This will give the section of coding needing a change.
    • Add a new input field for the subdomain. Do not call the field “subdomain”. WHMCS already uses this name. I used “subd” and “owndomainsubd”;

                <div>

  <input type="text" id="owndomainsubd" value="{$subd}" placeholder="Subdomain" class="form-control" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="Subdomain" />

</div>

<input type="text" id="owndomainsld" value="{$sld}" placeholder="Domain" class="form-control" autocapitalize="none" data-toggle="tooltip" data-placement="top" data-trigger="manual" title="{lang key='orderForm.enterDomain'}" />

 

    • Review and adjust as required and update the CSS if needed

4. Update the scripts.min.js to make the new data available to Hook

    • We recommend that you reformat the scripts.min.js file into a readable format. I copied the JS code into the JavaScript Beautifier. There are many tools on the Internet for reformatting coding.
    • In the routine, add line “subd”

 jQuery(".domain-selection-options .option").removeClass("option-selected"), jQuery(this).parents(".option").addClass("option-selected"), jQuery(".domain-input-group").hide(), jQuery("#domain" + jQuery(this).val()).show()

    }), jQuery("#frmProductDomain").submit(function(e)  e.preventDefault();

        var t = jQuery(this).find('button[type="submit"]'),

          e = jQuery("#DomainSearchResults"),

            n = jQuery("#spotlightTlds"),

            o = jQuery("#domainSuggestions"),

            f = jQuery("#btnDomainContinue"),

            i = jQuery(".domain-selection-options input:checked").val(),

            a = jQuery("#" + i + "sld"),

            r = a.val(),

            s = "",

            subd = jQuery("#owndomainsubd").val(),

            d = jQuery("#frmProductDomainPid").val(),

            l = "",

            m = jQuery("#idnLanguageSelector");

    • Second change to the JS, again adding “subd”;

 jQuery(".domain-selection-options .option").removeClass("option-selected"), jQuery(this).parents(".option").addClass("option-selected"), jQuery(".domain-input-group").hide(), jQuery("#domain" + jQuery(this).val()).show()

    }), jQuery("#frmProductDomain").submit(function(e) {

        e.preventDefault();

        var t = jQuery(this).find('button[type="submit"]'),

            e = jQuery("#DomainSearchResults"),

            n = jQuery("#spotlightTlds"),

            o = jQuery("#domainSuggestions"),

            f = jQuery("#btnDomainContinue"),

            i = jQuery(".domain-selection-options input:checked").val(),

            a = jQuery("#" + i + "sld"),

            r = a.val(),

            s = "",

        subd = jQuery("#owndomainsubd").val(),

            d = jQuery("#frmProductDomainPid").val(),

            l = "",

            m = jQuery("#idnLanguageSelector");

    • Save the JS file and check that the template is still functioning as before. The subdomain will not be processed until the hooks are created. It is good to check that the changes have not added new bugs to the system.

5. Create ShoppingCartValidateDomain hook

    • Create a PHP file in /includes/hooks/ directory e.g. subdomainvalidate.php

<?php

add_hook('ShoppingCartValidateDomain', 1, function($vars) {    

/// Clear session values

                $_SESSION['subd'] = '';

                $_SESSION['newdomain'] = '';    

//            logActivity('POST Data: ' . var_export($_POST, true));

               

/// set domain  

                $newdomain = isset($_POST['domain']) ? $_POST['domain'] : '';

                logActivity('ShoppingCartValidateDomain - New Domain: ' . $newdomain);

                $_SESSION['newdomain'] = $newdomain;           

/// set subdomain          

                $subd = isset($_POST['subd']) ? $_POST['subd'] : '';

//            logActivity('ShoppingCartValidateDomain - Subdomain: ' . $subd);

                $_SESSION['subd'] = $subd;        

//            logActivity('Session Data: ' . print_r($_SESSION, true), 0);                              

});

    • The hook is only performed when validating a domain name.
    • This script collects the data from the template and creates session values for the next hook.
    • The logActivity is helpful if you need to debug.

6. Create ShoppingCartViewCartOutput hook

    • Create a PHP file in /includes/hooks/ directory e.g. viewcartoutput.php

<?php

if (isset($_SESSION['cart']['products']) && isset($_SESSION['subd']) && !empty($_SESSION['subd'])) {

                foreach ($_SESSION['cart']['products'] as $key => $product) {

                               if (isset($product['domain']) && $product['domain'] === $_SESSION['newdomain']) {

               $_SESSION['cart']['products'][$key]['domain'] = $_SESSION['subd'] . '.' . $product['domain'];

               } } }         });

    • The hook will perform each time the cart is open
    • It will add the subdomain name to the correct domain name and not all domain names in the cart.
    • Below is an example of the output

whmcs exampe3 800

 

Last modified: Version 1.1 - 25 January 2025

 

Chinese green technology source

Access to China has been operating in China for over 20years. Over the past 7 years, we have been following the development of green technology.

Over this time, we have been creating databases, reviewing local projects, and building up local supplier networks.


Chinese green technology source

Make a start

Focus: Accessing the Chinese market services Audience: overseas businesses Last modified: v4.3 – 19 February 2026

Green technology

Chinese Green technology has been developing rapidly in response to consumer and government demands to reduce China's high pollution levels.

Green technology is key to the growth of most businesses over the next five years.

The development of Green Technology is yielding greater efficiency, lower costs, and higher productivity, as seen in electric vehicles, which offer significantly lower operating costs, improved performance, and enhanced safety.

Green Technology should give you more, not less, as a first priority. In setting priorities, this is the way: it removes all concerns and politics. In China today, green technology is reducing costs for the government, businesses, and consumers, helping to address high pollution levels.

Continue the Industrial Revolution

Our definition of Green Technology is the development of products and services that increase productivity and returns while reducing or replacing the use of products and practices that harm the health of our planet, its ecosystems, and its plants, animals, and people.

The process that began during the Industrial Revolution in the mid-18th century, driven by the use of fossil fuels, is now holding us back. The development and use of new technologies will see the next decade as crucial to world development as the Industrial Revolution in the mid-18th century.

New developments each week

Keeping up with Green Technology developments is challenging, given the significant investment required to develop new approaches and products each month. i.e., Car batteries; the general thinking is that they require rare metals, such as lithium and cobalt. This is no longer the case.

The issue for businesses and consumers is knowing which technology will give the greatest return on investment and when. It is no longer “if”.

e.g. China has the world's largest electric car and battery industry. This results in reduced costs, faster charging, and the removal of rare metals, such as lithium.

China is developing and deploying green technology.

China has some of the highest pollution levels in the world. This has driven the development and adoption of Green Technologies. The advantage Chinese businesses have over many parts of the world is their large domestic consumer market. The consumer market is demanding changes to reduce pollution, leading to significant investment in and development of Green Technology.

China does not have more Green Technology developers than the rest of the world. A large domestic market drives demand. Chinese businesses and consumers understand the changes, embrace them, and make purchases. e.g., one of the large petrol station companies in China is planning for the future, anticipating that demand for roadside fuel will greatly decline over the next five years. Plan for the changes while they still have a large customer base. What can we offer our customers when they no longer need fuel?

Innovation vs “more of the same”.

It is not good news from China. You need to separate the businesses in China that are bringing new ideas and products to market from those just copying existing products.

Businesses creating products that already exist are important. It allows China to meet a very large internal market, 1.4 billion people, in a fast-growing economy, which consumes products and services faster than anywhere else in the world. No one organisation can meet these demands.

The “more of the same” creates a comfort level that leads Chinese businesses to present the same ideas and products to overseas businesses, even when the technology has changed, e.g., Powerwall, which replaced lithium with sodium in its batteries. Sodium has been commercially available for the last few years. No one is offering the charge (early 2026), even though there are clear operational benefits to using sodium over lithium.

When working with Chinese suppliers, it can take a while to find the right products when you get into the details. “More of the same” vs the technology will last the lifetime of the investment.

Access to China has access to Chinese green technology.

Access to China has enabled Chinese staff to closely follow Green Technology's development in the Country over the last five years. Our access to Chinese databases includes numerous listings of various developments and products. If you are looking for Green Technology developments and products, please let us know; what you are looking for may already be available.

Useful links for China business

Where are you in the supply process

  • Understanding the market
  • Business required
  • Product specification
  • Manufacturing requirement
  • A specific product

Need help?

If you’d like assistance determining whether Chinese website hosting is right for your business, contact us at This email address is being protected from spambots. You need JavaScript enabled to view it..

Can your website be seen in China?

Test your website from China now

  • Does your website open first time in China?
  • Does your web pages open in under 5 seconds
  • Does a full page open in under 10 seconds?
  • Is your your site appearances correct?
  • Are all the images, videos, social media, etc., loading correctly?

Sourcing from China

Main sourcing areas:-

  • Trade fairs
  • Chinese export/import agents
  • Factories
  • Trade markets
  • Wholesale
  • B2B e-Commerce
  • B2C e-Commerce
  • Your country Chinese trade organisation

Useful links for working with China

A curated list of official and practical resources for internet, business, compliance, and trading with China.

Use these links to verify requirements, understand platforms, and plan your next steps.


Focus: official resources + planning Audience: overseas businesses Updated regularly

How to use this page

These links are grouped by common tasks. Where possible, we prioritise official sources and widely-used industry references.

If you are working on a time-sensitive issue (licensing, banking, tax, or compliance), always confirm requirements with a qualified local adviser.

Practical takeaway: Use this page for quick navigation — then confirm the latest requirements with the official source or your adviser.

China internet and ICP filing

Practical takeaway: If you host a public website or service on a China IP address, plan for ICP requirements early.

Chinese search engines and webmaster resources

Practical takeaway: For China SEO, always use the local webmaster platforms (indexing, verification, and guidelines).

Payments and e-commerce platforms

Practical takeaway: Start by understanding platform fees, deposits, logistics and returns — costs can change your margin.

Chinese social media platforms

  • WeChat (Weixin) — messaging, Official Accounts, Mini Programs.
  • Weibo — public social media and brand visibility.
  • Xiaohongshu (RED) — lifestyle, reviews, and social commerce.
  • Douyin — short video and live commerce.
  • Bilibili — video communities and youth culture.
Practical takeaway: Social platforms drive discovery first — sales come later through trust and repetition.

Chinese e-Commerce platforms

  • Tmall — brand-led B2C marketplace.
  • Taobao — C2C and social commerce.
  • JD.com — logistics-driven B2C platform.
  • Pinduoduo — price-driven, group-buying commerce.
  • 1688 — domestic B2B sourcing marketplace.
Practical takeaway: Each platform serves a different buyer type — choosing the wrong one is expensive.

Trade bodies and organisations

Practical takeaway: Trade bodies help with introductions, validation, and policy context — not instant deals.

Business verification and company lookup

Practical takeaway: Always validate who you are talking to, company status, and related entities before committing time or money.

Shipping and customs

Practical takeaway: For consumer shipments, plan duties/taxes and returns before you scale volume.

Helpful tools from Access to China

Practical takeaway: When a page is slow in China, the first step is always to identify blocked resources and routing/hosting constraints.
Useful links for China business

 

Quick checklist

Use these steps when you are researching or validating something in China.

  • Start with official sources (MIIT, CNNIC, Customs, GSXT).
  • Cross-check company registrations before sharing sensitive information.
  • Check whether services you rely on are blocked/slow in China (CDNs, fonts, analytics, maps).
  • Validate platform fees, deposits, and logistics rules before you commit.
  • Keep screenshots and notes — you’ll need them when comparing options.
Note: Requirements and URLs can change. If something looks different, treat it as a sign to re-check the official source.

Need help?

If you’d like help with China website performance, hosting, SEO, or platform strategy, contact This email address is being protected from spambots. You need JavaScript enabled to view it.

Sourcing from China

Access to China has sourced/manufactured over 300 products from China over many years. Our staff's understanding of the manufacturing process in China and the ability to source local products and components.


Sourcing from China

Make a start

Focus: Accessing the Chinese market services Audience: overseas businesses Last modified: v4.2 – 21 February 2026

Sourcing directly from the factories or the local wholesale market in China. Over the last 60 years, China has built its manufacturing base into one of the most successful in the world. Over the last 20 years, the growth of large-scale Chinese e-commerce and local social media has driven strong demand for high-quality local goods meeting international standards.

Changes in China

Over the last 60 years, China has built its manufacturing base into one of the most successful in the world.

For many years, you could purchase a Chinese consumer good at a considerable discount (over 75%) in Western countries compared to the price in a shop in China. This was due to;

  • Few Chinese chain stores
  • Local Stores without the purchasing power
  • Exported goods have no sales tax
  • Poor transport infrastructure
  • Poor distribution within China
  • Underdeveloped Chinese consumer market

Government investments followed, and changes followed.

Local Trading Changes in China starting 2010

This all started to change about 15 years ago, with phenomenal growth in China's mobile network, giving 80% of the Chinese population nationwide internet access in by 2015. This, combined with government investments in transport infrastructure and a growth in China's disposable income, resulted in;

  • Wholesalers and retailers online
  • Major online retail e-commerce sites, starting with Taobao (part of Alibaba)
  • Many shopping malls have been built in every city and many towns
  • Lower and faster transport costs

The growth of the Chinese domestic consumer market has increased imports of high-quality products from overseas. In turn, this has driven up the quality of locally produced products. Today, China is moving towards better quality products.

One of the biggest quality improvements was driven by the iPhone's availability in China in 2010. The feel and look of the iPhone, including packaging, became the quality standard over the years.

Over the last 15 years, as international travel has increased, Chinese consumers have gained greater knowledge of worldwide products and services. This, combined with a greater number of Chinese people educated overseas, is driving Chinese consumers to seek local, higher-quality products and services.

Manufacturing and wholesale

The advantage Chinese manufacturing has over many countries is the end-to-end supply chain for factories.

Very few Chinese factories make all the parts for a product. For example, a simple battery-powered bedside lamp has over 10 components, most of which will be sourced from different factories.

The products we recommend you look for from Chinese factories and suppliers are those that have already been successful in other countries, not just your own markets. This gives you the working marketing, business plan, etc, module to review and adopt if appropriate.

We have used six paths to locate Chinese suppliers.

  • Chinese trade fairs
  • Trade city markets, e.g.
    • Yiwu – general consumer products
    • Shenzhen - Computer and electronic products
  • Chinese export/import agents
  • Chinese search engines and B2B e-Commerce, e.g.
    • Baidu
    • Alibaba
  • Trade organisation (in China and in your local country)
  • Our local trading network

Innovation vs “more of the same”

It is not good news from China. You need to separate the businesses in China that are bringing new ideas and products to market from those just copying existing products.

Businesses creating products that already exist are important. It allows China to meet a very large internal market, 1.4 billion people, in a fast-growing economy, which consumes products and services faster than anywhere else in the world. No one organisation can meet these demands.

The “more of the same” creates a comfort level that leads Chinese businesses to present the same ideas and products to overseas businesses, even when the technology has changed.

When working with Chinese suppliers, it can take a while to find the right products when you get into the details. The new technology, once proven, will have a chance of lasting the lifetime of the investment.

Sourcing fom China

Sourcing from China

Main sourcing areas:-

  • Trade fairs
  • Chinese export/import agents
  • Factories
  • Trade markets
  • Wholesale
  • B2B e-Commerce
  • B2C e-Commerce
  • Your country Chinese trade organisation

Need help?

If you like assistance sourcing from China, please contact us at This email address is being protected from spambots. You need JavaScript enabled to view it..

Can your website be seen in China?

Test your website from China now

  • Does your website open first time in China?
  • Does your web pages open in under 5 seconds
  • Does a full page open in under 10 seconds?
  • Is your your site appearances correct?
  • Are all the images, videos, social media, etc., loading correctly?

Chinese Green Technology Sourcing

Green technology is key to the growth of most businesses over the next five years

Continue the Industrial Revolution in the mid-18th century:-

  • Solar energy
  • Electric car
  • Batteries
  • Wind Power

Access to China — Information Hub

Practical guidance for overseas businesses working with China.

Explore the article collections for being seen, being found, and starting to trade in China.


Focus: China internet + trading Audience: overseas businesses Updated regularly

How this hub is organised

The Access to China information library is organised into three practical collections. Each collection reflects how Chinese users, platforms, and regulations actually work.

Start with reliability (being seen), move to discovery (being found), and then build the trading model and operations (start trading).

Practical takeaway: Start with “Being seen”, then “Being found”, and only then focus on trading.

Browse the article collections

Use the tiles below to enter each collection. Each collection contains topic pages and practical checklists.

Being seen on the Chinese internet

Foundation

Website accessibility, hosting, performance, and trust. Can Chinese users actually load your site?

Being found in China

Discovery

Chinese search engines, SEO, content structure, and how discovery works inside Chinese platforms.

Start trading in China

Execution

Business models, ICP licensing, payments, shipping, B2B vs B2C, and practical risk reduction.

Access to China information hub

Most ‘China problems’ are technical and structural, not marketing-related.

Quick guidance

Use these checks to keep trust and usability high.

  • Can your site load fully inside mainland China (no blocked resources)?
  • Are you using third‑party services that are slow or blocked in China?
  • Does your structure work inside WeChat’s in‑app browser?
  • Do you understand ICP and China hosting rules for public sites?
  • Have you chosen the correct trading model (B2B, B2C, e‑Mall, distributor)?
Note: “Looking Chinese” is not the goal. Trust comes from consistency, authenticity, and a smooth mobile experience.

Need help?

If you’d like help improving mobile usability and China accessibility while keeping an authentic overseas brand feel, contact This email address is being protected from spambots. You need JavaScript enabled to view it.

Note: Looking “Chinese” is not the goal. Being reliable, fast, and clear is.