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:
co-authored by
Claude Haiku 4.5
parent
e5fb22aab1
commit
5bd6f3de39
@@ -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 ||
|
||||
|
||||
Reference in New Issue
Block a user