Skip to main content
Stores still using the classic, shortcode-based [woocommerce_checkout] page get the identical picker — same markup, same JavaScript controller, same labels — through a separate adapter built on classic checkout’s own hooks.

How it mounts

Unwan prints an empty mount point immediately before WooCommerce’s native billing and shipping forms:
The classic-checkout JavaScript (unwan-classic-checkout.js) reads a localized window.unwanClassicCheckout object — containing each customer’s checkout options, field keys, labels, and search threshold — and mounts the same shared controller used by Checkout Blocks (window.unwanAddressPicker, documented in the JavaScript API) into each placeholder.

Submission and validation

Unwan adds a hidden field per enabled selector (unwan_billing_address_id / unwan_shipping_address_id) holding the current selection, defaulting to the customer’s top-ranked option. On submit:
  1. woocommerce_after_checkout_validation rejects the order if a selector is enabled and its submitted value isn’t "new" and doesn’t match a real entry in that customer’s checkout options — the same server-side validation a crafted or stale request would need to defeat.
  2. woocommerce_checkout_update_customer_data returns false when either Unwan selection field is present, which stops WooCommerce’s own default customer-data write — Unwan persists only the address types the shopper actually chose to save as a default, on its own terms.
  3. woocommerce_checkout_update_user_meta saves a new address (if "new" was chosen and Save checkout addresses is on) and, if configured, promotes it to the matching profile default.
Unwan also fills in the customer’s WordPress display name from the billing name on this hook, but only when it’s currently empty or is still just the account email — it never overwrites a name the customer has already set.

Detecting Checkout Blocks pages

The classic-checkout script only enqueues on pages that are actually running the shortcode checkout. Unwan checks whether the current queried page contains the woocommerce/checkout block and skips its own classic assets if so, so the two adapters never both try to mount on the same page.