Skip to main content
Two rules make the single-library model safe to use without customers ever “losing” an address by accident: default swaps are lossless, and duplicates are recognized automatically.

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.
A displaced default bypasses the configured additional-address limit. Changing which address holds a role must never be the reason an address disappears from the book — so this specific insertion skips the unwan_address_save_limit check that normally applies when a customer manually adds a new address.

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.
  1. 456 Oak Ave is written into the billing profile field.
  2. Unwan notices 123 Main St used to be there and doesn’t match 456 Oak Ave.
  3. 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.
The customer now has both addresses in their book; nothing was deleted.

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:
where 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).
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.