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 <noreply@anthropic.com>
This commit is contained in:
chris 2026-05-05 10:51:18 -04:00
parent 2be379a029
commit ffd07e35bd
2 changed files with 5 additions and 3 deletions

View File

@ -387,8 +387,9 @@ export async function POST(req: NextRequest) {
// ── Fire-and-forget: emails only (calendar already written above) ──────── // ── 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 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 : undefined
void (async () => { void (async () => {

View File

@ -275,7 +275,7 @@ export default function CartDrawer() {
quantity: e.quantity, quantity: e.quantity,
priceCents: e.vinylShapePriceCents ?? 450, priceCents: e.vinylShapePriceCents ?? 450,
catalogItemId: e.vinylShapeVariationId, catalogItemId: e.vinylShapeVariationId,
note: 'For custom vinyl', note: `Vinyl add-on for: ${e.product.name}`,
}, },
{ {
name: 'Custom Vinyl', name: 'Custom Vinyl',
@ -283,6 +283,7 @@ export default function CartDrawer() {
priceCents: vinylCents, priceCents: vinylCents,
catalogItemId: e.product.variations[0]?.id ?? e.product.id, catalogItemId: e.product.variations[0]?.id ?? e.product.id,
note: [ note: [
`Add-on for: ${e.product.name}`,
`Text: "${e.vinylText}"`, `Text: "${e.vinylText}"`,
e.vinylFontName ? `Font: ${e.vinylFontName}` : null, e.vinylFontName ? `Font: ${e.vinylFontName}` : null,
].filter(Boolean).join(' | ') || undefined, ].filter(Boolean).join(' | ') || undefined,