WHMCS guide

Find why WHMCS is not charging tax.

A missing tax line is easy to miss: the invoice still adds up and the client pays it. The gap shows up when the tax return is due. It usually comes from one of four places, and each can be read from the database in seconds.

DMS.S2 — Before you start

Before you run anything.

Read only

Every query below is a SELECT. It changes nothing. Run it in phpMyAdmin or the mysql client, on a copy of the database if you have one.

Only if you charge tax

If your business does not collect tax, WHMCS is right to add none. The last query returns nothing when there are no tax rules, so it cannot hand you a false list.

Tested on sample rows

We ran each query on a test database with rows that should match and rows that should not: a 2-letter country, an empty country, a hidden product, a free product. Neither of our two live installs charges tax, so queries 2 to 4 return nothing there.

DMS.S3 — The queries

Four ways to find them.

Is tax switched on at all?

TaxEnabled must read on. Off voids every rule and every Apply Tax box. TaxDomains decides whether domain registrations and renewals are taxed too.

SELECT setting, value
FROM tblconfiguration
WHERE setting IN ('TaxEnabled', 'TaxDomains', 'TaxType');

Rules that never add anything

A 0% rate, a rate above 100% (1700 typed for 17), a rule with no name, or a country saved as a word by an import or the API. WHMCS matches the client's 2-letter country code, so Brazil or United States never matches anyone.

SELECT id, level, name, country, state, taxrate
FROM tbltax
WHERE taxrate <= 0 OR taxrate > 100 OR TRIM(name) = ''
  OR (TRIM(country) <> '' AND LOWER(TRIM(country)) <> 'any'
      AND TRIM(country) NOT REGEXP '^[A-Za-z]{2}$');

Two rules for the same place

Same level, country and state. WHMCS applies the first one it finds, so the other never fires, and editing it changes nothing.

SELECT level, UPPER(TRIM(country)) AS country, LOWER(TRIM(state)) AS state,
       COUNT(*) AS rules, GROUP_CONCAT(id) AS ids
FROM tbltax
GROUP BY level, UPPER(TRIM(country)), LOWER(TRIM(state))
HAVING rules > 1;

Paid products and add-ons with Apply Tax off

Each product and add-on has its own Apply Tax box. A new product copied from an untaxed one keeps it off. Hidden and free items are left out.

SELECT 'product' AS kind, id, name FROM tblproducts
WHERE tax = 0 AND paytype <> 'free' AND hidden = 0 AND retired = 0
  AND EXISTS (SELECT 1 FROM tbltax)
UNION ALL
SELECT 'addon', id, name FROM tbladdons
WHERE tax = 0 AND hidden = 0
  AND LOWER(REPLACE(REPLACE(billingcycle, '-', ''), ' ', '')) NOT IN ('free', 'freeaccount')
  AND EXISTS (SELECT 1 FROM tbltax);

DMS.S4 — The addon

Or get the list inside the WHMCS admin.

Brasa Pricing Audit runs these tax checks with the rest of its catalog checks, only when your store charges tax, and e-mails admins when a new finding appears. It never changes a setting, a rule or a price.

Brasa Pricing Audit screen in the WHMCS admin, with sample data

Brasa Pricing Audit

$39 per year

Finds the price and catalog setups that give away money or block a sale.

  • Billing cycle at 0.00 and no price row in a currency
  • Promo code with no limit that makes an order free
  • Free domain on a term whose first payment does not cover the registration
  • Visible item with every cycle off, automatic setup with no server, 56 checks in all
First run in 16 seconds, on sample data: the summary, then each finding with what to fix. Brasa Pricing Audit on the WHMCS Marketplace
Buy for $39

DMS.S5 — Questions

Getting tax back on the invoice.

Where do I turn tax on?

Configuration > System Settings > Tax Configuration. Set Tax Support to ON, choose inclusive or exclusive, decide on domains, and add the rules on the Tax Rules tab. Then tick Apply Tax on each paid product and add-on that should carry it.

Does fixing the setup add tax to invoices already issued?

No. WHMCS works out tax when it creates an invoice. The fix applies to the next invoices, including renewals. Invoices already sent keep their amounts; correct them only with your accountant.

Everything above looks right and one client still pays no tax. Why?

Check that client's profile. A client marked Tax Exempt pays no tax on any invoice, and a client whose country or state does not match any rule falls outside every rule.