From ffd07e35bd076f996036cd04ec0c58090760d296 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 5 May 2026 10:51:18 -0400 Subject: [PATCH] fix: vinyl order attribution and 1-hour customer delivery window Vinyl line items now include the parent product name in their notes ("Vinyl add-on for: X" and "Add-on for: X | Text: ...") so the Square dashboard and receipts show which item the vinyl belongs to. Confirmation emails now show a 1-hour arrival window (was 2.5 hrs because jobMin for classic tier was used; jobMin is still sent to Square as deliveryWindowDuration for internal job scheduling). Co-Authored-By: Claude Sonnet 4.6 --- estore/src/app/api/checkout/route.ts | 5 +++-- estore/src/components/CartDrawer.tsx | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/estore/src/app/api/checkout/route.ts b/estore/src/app/api/checkout/route.ts index 4438e34..2e8856a 100644 --- a/estore/src/app/api/checkout/route.ts +++ b/estore/src/app/api/checkout/route.ts @@ -386,9 +386,10 @@ export async function POST(req: NextRequest) { if (!captured) throw new Error('Payment capture returned no result') // ── Fire-and-forget: emails only (calendar already written above) ──────── - const subtotalCents = lineItems.reduce((sum, li) => sum + li.priceCents * li.quantity, 0) + const subtotalCents = lineItems.reduce((sum, li) => sum + li.priceCents * li.quantity, 0) + const CUSTOMER_WINDOW_MIN = 60 // 1-hour arrival window shown to customer const slotEndISO = deliverySlotISO - ? new Date(new Date(deliverySlotISO).getTime() + jobMin * 60_000).toISOString() + ? new Date(new Date(deliverySlotISO).getTime() + CUSTOMER_WINDOW_MIN * 60_000).toISOString() : undefined void (async () => { diff --git a/estore/src/components/CartDrawer.tsx b/estore/src/components/CartDrawer.tsx index 69126c2..f15c2cd 100644 --- a/estore/src/components/CartDrawer.tsx +++ b/estore/src/components/CartDrawer.tsx @@ -275,7 +275,7 @@ export default function CartDrawer() { quantity: e.quantity, priceCents: e.vinylShapePriceCents ?? 450, catalogItemId: e.vinylShapeVariationId, - note: 'For custom vinyl', + note: `Vinyl add-on for: ${e.product.name}`, }, { name: 'Custom Vinyl', @@ -283,6 +283,7 @@ export default function CartDrawer() { priceCents: vinylCents, catalogItemId: e.product.variations[0]?.id ?? e.product.id, note: [ + `Add-on for: ${e.product.name}`, `Text: "${e.vinylText}"`, e.vinylFontName ? `Font: ${e.vinylFontName}` : null, ].filter(Boolean).join(' | ') || undefined,