"Same as billing address" is probably the smallest checkbox in your checkout. It is also one of the most expensive — in support tickets, in failed deliveries, and in the kind of subtle data corruption that only shows up weeks later.
The checkbox itself is trivial. Copy a handful of fields from one section to another. The trouble starts with what "copying an address" actually means.
Copy the fields, not a formatted string
The tempting implementation is to store one formatted address string and paste it into both the billing and shipping blocks. Then a user edits the shipping line, and the two diverge in ways your data model cannot represent. Copy the structured fields — street, unit, city, state, postcode, country — not their rendered form. Keep billing and shipping as separate records that happen to start equal.
Watch the fields you forgot to copy
Address forms accumulate fields over time. A company line added last quarter. A deliveryInstructions textarea. A phone field with a country code. When someone adds a new field to billing and forgets to add it to the copy routine, "same as billing" quietly drops it. Then a package shows up without the suite number the customer swears they entered.
Every new address field is a place the copy logic can rot. That is a testing problem more than a coding one.
Leading zeros do not survive a round trip
If billing ZIP is stored as 02108 and shipping ZIP is copied through a numeric field, "same as billing" turns it into 2108. The two addresses are now different, the checkbox says otherwise, and nothing in the UI hints at the mismatch. Identifiers must stay strings through every copy, transform and export.
The user can uncheck it — and then recheck it
A common bug: the checkbox copies values once, on change. The user checks it, edits the copied fields directly, unchecks it to fix billing, then rechecks it — and the stale copy overwrites their edits. Treat the checkbox as a live relationship, not a one-time snapshot, and decide explicitly what rechecking does to already-edited fields.
Keep a library of awkward addresses to test it with
None of these are exotic edge cases; they are ordinary addresses with ordinary punctuation and ordinary zeros. They only become bugs because nobody tests them through the checkout flow. You want a stable set of addresses that includes a unit designator, a leading-zero ZIP, a hyphenated name, an international format, and an address with no state — then run "same as billing" against every one.
AddressLab is a free, no-sign-up generator for synthetic addresses like these. It produces US records with state, ZIP, phone and unit fields plus multi-country formats, and exports selected fields as CSV or JSON so the fixtures live in your repo. Generated addresses are for development, testing, education and prototypes — they are not real identities and will not receive mail.
The checkbox saves the customer ten seconds. Making it correct is on you. Test the copy path with data that is awkward enough to break it, and the smallest checkbox in checkout stops being the most expensive.
Top comments (1)
The 02108 → 2108 example is the one that should be on a poster in every checkout team — a silent corruption where the UI keeps insisting the addresses match. And your 'copy the fields, not a formatted string' rule is the real fix: two records that happen to start equal, not one record pretending to be two.
The failure mode I'd add: the recheck case. If the copy runs once on change, a user who checks, edits shipping, then unchecks and rechecks gets their edit silently overwritten — or worse, keeps a stale copy depending on which direction your code syncs. The checkbox needs to be a live binding or a one-time snapshot, and most implementations are neither — they're an accident.
One question on the 'fields you forgot to copy' rot: since every new address field is a place the copy logic can rot, have you found a way to make the copy derive from the form schema itself — one field list that both sections read — instead of a hand-maintained copy list? That's the only version of this I've seen that doesn't eventually drift.