Lossless default swaps
When an entry is promoted to a default role it didn’t already hold, Unwan doesn’t just overwrite the old default and discard it — it checks whether that displaced address is still represented anywhere else in the book first.1
The new address is written to the profile field
Whatever entry is being promoted has its fields written into the WooCommerce billing or shipping profile field it’s now claiming.
2
The displaced address is checked
Unwan reads what used to be in that profile field, before the overwrite.
3
It's dropped, or preserved
If the displaced address is empty, or its normalized signature matches the address that just replaced it, nothing further happens. Otherwise, it’s inserted into the shared additional-address collection — so it’s still in the book, just without a default role anymore.
Worked example
A customer’s billing default is 123 Main St. They add a new address, 456 Oak Ave, and check “Default billing address” while saving it.- 456 Oak Ave is written into the billing profile field.
- Unwan notices 123 Main St used to be there and doesn’t match 456 Oak Ave.
- 123 Main St is added to the shared collection as a plain, role-free additional address — even if the customer was already at their saved-address limit.
Duplicate detection
Before any address is saved — whether typed into My Account, entered at checkout, or displaced by a default swap — Unwan checks it against every existing entry (both profile defaults and every additional address) using a normalized signature:normalize() strips accents, collapses whitespace, and lowercases the value. Company, city, state, postcode, country, and phone are not part of the signature — the comparison is deliberately narrow, matched to how customers actually think of “the same address.” An address with no street line at all never produces a signature and is treated as always-unique (it can’t collide, but it also can’t be detected as a duplicate).
- New address at checkout
- Editing in My Account
- Billing = shipping at checkout
If a customer types an address at checkout that matches an existing entry’s signature, Unwan reuses the existing entry’s ID instead of creating a new one — so filling in the same details twice never creates two records.