discounts

This commit is contained in:
Priec
2026-06-21 22:33:47 +02:00
parent 2ee87fbdd7
commit 9ce1cb97f0
20 changed files with 399 additions and 10 deletions

View File

@@ -201,14 +201,15 @@ pub(crate) async fn resolve_cart(
if qty == 0 {
continue;
}
let line_total = product.price_cents * i64::from(qty);
let unit_price = product.effective_price_cents();
let line_total = unit_price * i64::from(qty);
total += line_total;
valid.push((product.id, qty));
lines.push(json!({
"id": product.id,
"name": product.name,
"slug": product.slug,
"price": format_price(product.price_cents),
"price": format_price(unit_price),
"currency": product.currency,
"quantity": qty,
"stock": product.stock,