Jump to content

Domain Price Recalculate


Recommended Posts


Is there a way via a script/API to perform the 'Recalculate' function on all active domains in WHMCS?

The reason I want to do this is that we have some TLD's that we need to adjust pricing for. I understand there is the Bulk Pricing Updater tool but I don't think this will be suitable. The reason for this is that some of our clients have promo codes associated with their domains and we'd need to recalculate their new recurring amount based on the current TLD pricing in '/admin/configdomains.php'.

Also, if you have a lot of TLD's on various registration lengths and on different prices, the Bulk Pricing Updater tool doesn't make things easy.

I found this:


Does anyone know if this tool does what I'm asking?

I'm surprised WHMCS hasn't got native functionality for this yet! 😕

Thanks in advance!

Link to comment
Share on other sites

Here is a daily cron hook to recalculate domain pricing:



* Hook to automatically recalculate pricing for domains after daily cron is ran

if (!defined("WHMCS"))
die("This file cannot be accessed directly");

use WHMCS\Database\Capsule;

add_hook('DailyCronJob', 1, function($vars)
    logActivity('Starting autorecalculate for domains	', 0);
    $adminUsername = ''; // Optional for WHMCS 7.2 and later

    foreach (Capsule::table('tbldomains')->pluck('id') as $v)
        localAPI('UpdateClientDomain', array('domainid' => $v, 'autorecalc' => true), $adminUsername);
    logActivity('Ending autorecalculate for domains	', 0);



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated