# Checkout Address Forms

> BillingAddressForm and ShippingAddressForm with Woo field schema, country/state controls, and shipping toggle.

<!-- Sources: src/Components/Woo/BillingAddressForm/BillingAddressForm.php; src/Components/Woo/ShippingAddressForm/ShippingAddressForm.php; src/Components/Woo/Shared/AddressFormProperties.php; src/Components/Woo/Shared/AddressFormMarkup.php; src/Woo/CheckoutFieldSchema.php; client/src/domains/woo/components/address-fields.ts; client/src/domains/woo/components/shipping-address-form.ts; client/src/domains/woo/checkout-field-schema.ts; tests/e2e/components/woo/behavior.spec.ts -->

# Checkout Address Forms

This family renders Woo billing and shipping fields. Field definitions are authored in components, but runtime field rules come from Woo's checkout schema.

## Components

| Component key | Role |
| --- | --- |
| `OmeWooBillingAddressForm` | Renders billing address fields. |
| `OmeWooShippingAddressForm` | Renders shipping address fields plus the different-shipping toggle. |

## Shared Field Props

Both address forms expose the same field-copy pattern:

| Prop | Meaning |
| --- | --- |
| `content.legend` | Fieldset legend text. |
| `content.show_legend` | Renders or hides the legend. |
| `{field}.use_woo_defaults` | Uses Woo label, hint text, and validation copy. |
| `{field}.label` | Custom label when Woo defaults are disabled. |
| Field hint copy | Custom input hint copy when Woo defaults are disabled. |
| `{field}.error_message` | Custom local validation copy when Woo defaults are disabled. |
| `accessibility.aria_label` | Fieldset accessible label. |
| `preview.state` | Builder preview state. |

Billing includes email and phone. Shipping does not.

## Shipping Toggle Props

`ShippingAddressForm` adds:

| Prop | Meaning |
| --- | --- |
| `shipping_toggle.label` | Visible toggle label. |
| `shipping_toggle.use_aria_label` | Uses a separate ARIA label when true. |
| `shipping_toggle.aria_label` | Accessible toggle label when enabled. |
| `shipping_toggle.preview_checked` | Builder preview checked state. |

Runtime hides shipping fields until the toggle is checked.

## Runtime Field Rules

Runtime applies the Woo schema:

| Rule | Runtime result |
| --- | --- |
| `hidden` | Field root becomes hidden and controls are disabled. |
| `required` | Field gets `data-ome-required`, and checkout validation uses it. |
| `label` | Label text is updated unless custom copy is enabled. |
| Field hint copy | Input hint copy is updated unless custom copy is enabled. |
| `type` | Native input type is updated. |
| `priority` | Field roots are sorted by Woo priority. |
| `autocomplete` | Autocomplete token is applied. |

Country and state controls are UIChoice-backed. State can become select, text, or hidden depending on the selected country.

## Scenario Coverage

| Scenario | Covered behavior |
| --- | --- |
| `checkout_success` | Billing fields, country/state choices, and payment data produce a real order. |
| `checkout_validation_error` | Required and invalid billing fields are marked locally. |
| `checkout_terms_blocked` | Checkout notices mark error state without unsafe HTML. |
| `checkout country changes refresh state control` | State changes from ready to hidden after country change. |
| `checkout shipping address fields follow toggle` | Shipping fields show and hide with the embedded toggle. |
