
How to Add a Credit Balance Widget in WHMCS Using a Single Hook File
If you're using WHMCS to manage your clients, having a quick overview of the account credit balance right on the client dashboard improves both user experience and transparency.
In this guide by PyNoxi, we'll show you how to add a beautifully designed Credit Balance Widget using just a single hook file. This is especially helpful for web hosting companies that want to offer a cleaner and more informative client area.
✨ Why Add a Credit Balance Widget?
- Clients can instantly view their current credit.
- Enhances trust and professionalism.
- Allows quick access to the Add Funds page.
- Adds visual appeal to your WHMCS dashboard.
📂 Hook File Code (Simple & Clean)
Just place the following code in a credit-info-hook.php
file inside your WHMCS_PATH/includes/hooks/
directory of WHMCS:
Path will look like this- domain.com/includes/hooks/credit-info-hook.php
Here's Complete Php Hook
<?php
add_hook('ClientAreaHomepagePanels', 1, function($homePagePanels) {
// Get the client data and check ID is valid
$client = Menu::context("client");
$clientId = intval($client->id);
if ($clientId === 0) {return;}
$newPanel = $homePagePanels->addChild(
'clientCreditWidget',
array(
'name' => 'Account Credit',
'label' => Lang::trans('statscreditbalance'),
'icon' => 'fas fa-money-bill',
'order' => '99',
'extras' => array(
'color' => 'orange',
'btn-link' => 'https://your-domain.com/dash/clientarea.php?action=addfunds',
'btn-text' => Lang::trans('addfunds'),
'btn-icon' => 'fas fa-plus',
),
)
);
$newPanel->addChild(
'clientCreditWidget-content',
array(
'label' => '<h3 class="text-center pt-3 pb-2">' . formatcurrency($client->credit, $client->currencyId) . '</h3>',
'order' => 1,
)
);
});
🧠How It Works
- The hook uses the
ClientAreaHomepagePanels
event.
- It dynamically checks if a client is logged in.
- Then, it creates a panel named "Account Credit" with an icon and color.
- The widget also includes a button to Add Funds.
- Inside the panel, it shows the credit balance with proper currency formatting.
🎨 Styling with PyNoxi’s Brand Touch
For PyNoxi Web Solutions, we used an orange accent to make the widget pop. However, feel free to match it with your brand's color scheme by editing the 'color' => 'orange'
line.
You can replace it with:
blue
green
red
purple
grey
Just ensure it's consistent with your WHMCS template.
📌 Bonus Tip: Show More WHMCS Widgets
Want to enhance your dashboard further?
✅ Add total number of services
✅ Show unpaid invoice amount
✅ Display active tickets
All can be added via the same ClientAreaHomepagePanels
hook!
🚀 Need VPS or Cheapest Reseller Hosting?
Looking for powerful VPS or budget-friendly reseller hosting to power your websites?
👉 Visit PyNoxi.Com — your trusted hosting partner in India.
We provide:
- Blazing fast VPS Servers
- Cheapest Reseller Hosting plans
- 24x7 support and 7-Day Money Back Guarantee
🔚 Final Thoughts
Adding a Credit Balance Widget using a single hook in WHMCS is a great way to boost client experience with minimal coding effort. PyNoxi always aims to help you simplify hosting operations and look more professional.
Have questions? Reply below or message the PyNoxi Team.
Keywords: WHMCS credit widget, add credit balance in WHMCS, WHMCS dashboard widget, WHMCS client area panel, WHMCS single hook widget, PyNoxi Web Solutions hosting, best reseller hosting India, VPS PyNoxi