feat(admin): move allow_update_discount option to product level
All checks were successful
Staging Build / build (push) Successful in 2m50s

This commit is contained in:
DanielS
2026-07-10 09:15:34 +02:00
parent bc6487bba4
commit 27fe6c6eef
7 changed files with 39 additions and 31 deletions

View File

@@ -183,11 +183,11 @@ export function buildOrderSnapshot(
multiplier = 0.90
}
// Multiply only one_time item totals by multiplier if category allows it
// Multiply only one_time item totals by multiplier if product allows it
items.forEach(item => {
if (item.billing_interval === 'one_time') {
const cat = categories.find(c => c.id === item.category_id);
const allowDiscount = cat ? (cat as any).allow_update_discount !== false : true;
const prod = products.find(p => p.id === item.product_id);
const allowDiscount = prod ? prod.allow_update_discount !== false : true;
if (allowDiscount) {
item.item_total = item.item_total * multiplier;
}

View File

@@ -17,6 +17,7 @@ export type Product = {
show_in_abo?: boolean
requirements?: string[]
exclusions?: string[]
allow_update_discount?: boolean
}
export type Category = {
@@ -32,7 +33,6 @@ export type Category = {
show_in_kauf?: boolean
show_in_abo?: boolean
resets_others: boolean
allow_update_discount?: boolean
created_at: string
}