Skip to content

fix: keep the guest's contact email on the cart and order addresses - #2

Merged
alecritson merged 1 commit into
mainfrom
fix/keep-guest-contact-email
Oct 2, 2026
Merged

alecritson merged 1 commit into
mainfrom
fix/keep-guest-contact-email

Conversation

@alecritson

Copy link
Copy Markdown
Contributor

Problem

A guest's email never reached the order. The contact step stores it on the checkout session (and on the shipping row if one already exists), but:

  • Lunar rewrites an address row wholesale on setShippingAddress / setBillingAddress.
  • The address forms never send an email, so toCartAddressData writes contact_email as empty, wiping whatever the contact step copied.
  • assertContactKnown reads the session first, so payment still goes through and nothing flags the gap.

Result: placed guest orders have no contact_email on either address, so order confirmation mails and the panel have nobody to write to.

Fix

  • Address writes (storeShippingAddress, storeBillingAddress, and the express collect mirror) carry the email over: the payload's own email wins (wallet sheets send one), then the existing row's, then the session's.
  • Completion stamps any order address still missing an email from the session, falling back to the signed-in customer's email. Covers contact given after the last address write, and both the sync and async paths.

Tests

  • New GuestContactEmailTest: contact then shipping address, billing address, payload email wins, and a guest order placed with both addresses carrying the email.
  • ExpressCollectFlowTest: the basket page wallet collect order now asserts both order addresses carry the email (fails before the fix).
  • Full suite: 272 passed, 1 skipped. phpstan and pint clean.

🤖 Generated with Claude Code

Lunar rewrites an address row wholesale and the address forms never send
an email, so saving an address after the contact step wiped the guest's
email. Placed guest orders had no contact email on either address, leaving
confirmations and the panel nothing to read.

Address writes now carry the email over (payload, then the existing row,
then the session), and completion stamps any order address still missing
one from the session or the signed-in customer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alecritson alecritson self-assigned this Oct 2, 2026
@alecritson
alecritson merged commit 14983f9 into main Oct 2, 2026
5 checks passed
@alecritson
alecritson deleted the fix/keep-guest-contact-email branch October 2, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant