Feature: Implement context-aware pricing for product types

Updates pricing logic to use correct price based on product type:
- Updated getEffectivePrice to accept priceType parameter ('base', 'plain', 'personalised')
- Updated toProductDTO to accept and use priceType when computing effective price
- Updated made-to-order pages to use 'personalised' price type
- Updated products catalog pages to use 'plain' price type
- Updated checkout logic to determine price type based on design

Pricing behavior:
- Personalised orders (with design): use personalisedPrice if set, else basePrice
- Plain/blank orders (no design): use plainPrice if set, else basePrice
- Ready-made orders (no design, no plainPrice): use basePrice

All prices now correctly reflect the product variant being purchased.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-20 18:16:17 +01:00
co-authored by Claude Haiku 4.5
parent e5fb22aab1
commit 5bd6f3de39
9 changed files with 31 additions and 12 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ export default async function ProductsPage({ searchParams }: { searchParams: Sea
const activePromotions = await fetchActivePromotions();
const rows = await prisma.product.findMany({ where, orderBy: { createdAt: 'asc' } });
const products = rows.map((p) => toProductDTO(p, activePromotions));
const products = rows.map((p) => toProductDTO(p, activePromotions, 'personalised'));
const hasFilters =
selectedCategories.length > 0 ||