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.
WHMCS guide
A test code at 100% that nobody deleted keeps working for anyone who finds it, and a recurring one takes every renewal too. On one of our own installs the first query below found a 100% recurring code with no use limit and no end date, already used 4 times.
DMS.S2 — Before you start
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.
A partner, a staff account or a holiday offer can be free on purpose. Ask whoever created the code before you change it.
Deleting a code removes the record of who used it. Set an expiration date or a use limit under Configuration > Promotions instead.
DMS.S3 — The queries
Percentage codes at 100% or more with no use limit and no end date in the past. A far-off end date counts as no limit.
SELECT id, code, recurring, recurfor, uses, expirationdate
FROM tblpromotions
WHERE type = 'Percentage' AND value >= 100 AND maxuses = 0
AND (expirationdate IS NULL OR expirationdate < '1000-01-01' OR expirationdate >= CURDATE());
Recurring with no end (recurfor = 0) means every renewal, for as long as the service lives.
SELECT id, code, value, uses, expirationdate
FROM tblpromotions
WHERE type = 'Percentage' AND recurring = 1 AND recurfor = 0 AND value >= 50
AND maxuses = 0
AND (expirationdate IS NULL OR expirationdate < '1000-01-01' OR expirationdate >= CURDATE());
Shows whether a code has already cost you renewals. Expiring the code does not change these services; their price is stored on each one.
SELECT p.code, p.type, p.value, COUNT(*) AS live_services, SUM(h.amount = 0) AS renewing_at_zero
FROM tblhosting h
JOIN tblpromotions p ON p.id = h.promoid
WHERE h.domainstatus IN ('Active', 'Suspended')
GROUP BY p.id, p.code, p.type, p.value
HAVING renewing_at_zero > 0;
DMS.S4 — The addon
Brasa Pricing Audit runs these checks and the ones SQL cannot do alone, like a fixed amount or price override code that covers the first payment, and e-mails admins when a new finding appears. It never changes a code or a price.

$39 per year
Finds the price and catalog setups that give away money or block a sale.
DMS.S5 — Questions
Edit it under Configuration > Promotions and set an expiration date of today or a maximum number of uses equal to the current uses. New orders stop accepting it and the record of past use stays.
No. WHMCS stores the recurring amount on each service when the order is placed. Change the recurring amount on the service itself, and tell the client first if the discount was promised.
A fixed amount or price override is free only when it covers the price, which depends on the product, the cycle and the currency. Compare each one with the prices it applies to, or let Brasa Pricing Audit do that comparison.
DMS.S6 — Start a project
Tell us how the code was set up. If other hosts would hit it, it may become a check.