feat: check category eligibility for update discount in frontend and backend
Some checks failed
Staging Build / build (push) Has been cancelled

This commit is contained in:
DanielS
2026-07-10 00:18:23 +02:00
parent 2038c4df3e
commit a3c5a66d3f
2 changed files with 9 additions and 7 deletions

View File

@@ -353,16 +353,14 @@ export function OrderWizard({
})
const totalItem = base + modulesSum
if (prod.billing_interval === 'one_time') {
oneTime += totalItem
const allowDiscount = (cat as any).allow_update_discount !== false
const finalItemTotal = allowDiscount ? (totalItem * updatePriceModifier.multiplier) : totalItem
oneTime += finalItemTotal
} else {
monthly += totalItem
}
})
}
// Apply update modifier to oneTime total
if (updatePriceModifier.multiplier !== 1) {
oneTime = oneTime * updatePriceModifier.multiplier
}
return { monthlyTotal: monthly, oneTimeTotal: oneTime }
}, [selections, products, categories, moduleQuantities, updatePriceModifier])