Skip to main content
Unwan’s picker is a small, standard-DOM controller shared by Checkout Blocks and classic checkout — there’s exactly one implementation to reason about, not two.

window.unwanAddressPicker

Instances are tracked in a WeakMap keyed by their mount element, so there’s no manual bookkeeping and no risk of leaking a detached controller.

Data shape

The controller expects roughly this shape (matching what unwan_checkout_address_options produces server-side):

The selection event

Selecting an option — by click or keyboard — dispatches a bubbling custom event on the mount element:
Both checkout adapters listen for this to sync their hidden field (classic checkout) or Store API extension data (Blocks) and to show/hide the native address fields underneath.

Standard-DOM guarantees

The picker deliberately avoids anything that would make it hard to inspect, override, or extend:
  • No custom element (customElements.define) and no Shadow DOM — everything renders as plain <div>/<span>/<button> markup you can select and style with ordinary CSS.
  • No style mutation from JavaScript — all presentation lives in assets/css/unwan.css, documented on the CSS Variables & Markup page.
  • Full keyboard support out of the box: Arrow Up/Down/Left/Right, Home, and End move and select within the role="radio" group, matching standard radio-group behavior.

window.unwanClassicCheckout

On classic checkout only, Unwan localizes a private, per-request configuration object consumed by unwan-classic-checkout.js to mount the shared picker into each .unwan-checkout__selector placeholder: checkout options for each enabled type, field keys, the store’s base country, the search threshold, and picker labels. This object is checkout-request-specific and isn’t intended as a public integration point — filter the data going into it server-side instead, via unwan_classic_checkout_picker_data (see the Hooks Reference).