Member Function Renewal Errors


A Call to a member function error displays in the Client Area for some users:

Error: Call to a member function getOnDemandRenewalSettings() on null in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/User/Client.php:0


Error: Call to a member function enabledMetrics() on null in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/Service/Service.php:0


The user’s current client has an orphaned service. An orphaned service is a service for a product that does not exist.

The system does not allow admins to delete products that have an associated service, indicating that someone deleted the data directly from the MySQL® database.


Run the following query on your WHMCS MySQL database to identify the orphaned services. You can do this using a tool like phpMyAdmin:

SELECT * FROM `tblhosting` WHERE `packageid` NOT IN (select id from tblproducts)


To fix this, assign the orphaned services to a product:

  1. In the WHMCS Admin Area, go to Configuration () > System Settings > Products/Services.

  2. Click Create a New Product.

  3. Enter a product name (for example, Orphaned Service).

  4. Click Continue.

  5. Note the package ID that displays in the URL in your browser’s URL bar:

    Package ID 28

  6. Run this MySQL query to assign the orphaned services to the newly-created product, replacing XX with the package ID from the URL:

    UPDATE tblhosting SET packageid='XX' WHERE packageid NOT IN (SELECT id FROM tblproducts);

Last modified: June 11, 2024