Fix pricing calculation: remove feedback loop in updatePrice

wizard.addonFee was being subtracted and then recalculated each call,
causing prices to accumulate/subtract randomly on checkbox toggle.
Simplified to just sum base + checked addons + formation fees.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-29 08:55:21 -05:00
parent 2927b5cebb
commit b473bf1783

View file

@ -467,20 +467,24 @@ select:focus,input:focus{outline:none;border-color:#1e3a5f;box-shadow:0 0 0 2px
function updatePrice() {
var total = wizard.baseFee;
var details = ['Base: $1,299'];
// Add-on fees from checked checkboxes
document.querySelectorAll('[data-reg]').forEach(function(cb) {
if (!cb.checked) return;
var key = cb.dataset.reg;
if (key === 'stir_shaken') { total += 49900; details.push('STIR/SHAKEN: +$499'); }
if (key === 'ocn') { total += 265000; details.push('OCN: +$2,650'); }
if (key === 'state_puc') { total += 39900; details.push('State PUC: +$399'); }
if (key === 'state_puc') { total += 39900; details.push('State PUC: +$399/state'); }
});
total += wizard.formationFee + wizard.stateFee;
if (wizard.formationFee) details.push('Formation: +$' + ((wizard.formationFee + wizard.stateFee) / 100).toLocaleString());
total -= wizard.addonFee; // discount placeholder
// Formation fees (if new entity)
if (wizard.formationFee || wizard.stateFee) {
total += wizard.formationFee + wizard.stateFee;
details.push('Formation: +$' + ((wizard.formationFee + wizard.stateFee) / 100).toLocaleString());
}
document.getElementById('total-price').textContent = '$' + (total / 100).toLocaleString();
document.getElementById('price-detail').textContent = details.join(' · ');
wizard.addonFee = total - wizard.baseFee - wizard.formationFee - wizard.stateFee;
}
// ── Step 2 → 3 ──