diff --git a/src/app/api/checkout/route.ts b/src/app/api/checkout/route.ts index c758652..427878f 100644 --- a/src/app/api/checkout/route.ts +++ b/src/app/api/checkout/route.ts @@ -75,10 +75,14 @@ export async function POST(req: Request) { } const activePromotions = await fetchActivePromotions(); - const pricedItems = items.map((i) => ({ - ...i, - unitPrice: getEffectivePrice(productsById.get(i.productId)!, activePromotions).price, - })); + const pricedItems = items.map((i) => { + const design = i.designJson as { front: unknown[]; back: unknown[] }; + const isPersonalised = design.front.length > 0 || design.back.length > 0; + return { + ...i, + unitPrice: getEffectivePrice(productsById.get(i.productId)!, activePromotions, new Date(), isPersonalised).price, + }; + }); const total = pricedItems.reduce((sum, i) => sum + i.unitPrice * i.quantity, 0); const customer = await getCurrentCustomer();