> ## Documentation Index
> Fetch the complete documentation index at: https://docs.smartwpplugins.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hooks Reference

> Every PHP filter and action Unwan exposes

<Warning>
  Address arrays contain private customer data (name, phone, postal address). Never log them. Register these filters before the address book is first read on a request — normalized results are cached per-request and won't re-run your filter mid-page.
</Warning>

## Filters

### `unwan_address_field_keys`

Filters which field keys are stored for every address-book entry.

```php theme={null}
apply_filters( 'unwan_address_field_keys', array $keys ): array
```

Email is intentionally excluded by default — it belongs to account identity, not a postal address.

### `unwan_saved_addresses`

Filters a customer's normalized shared additional addresses after metadata is read.

```php theme={null}
apply_filters( 'unwan_saved_addresses', array $addresses, int $user_id ): array
```

### `unwan_checkout_address_options`

Filters the checkout-ready option list used by **both** classic and Blocks checkout.

```php theme={null}
apply_filters( 'unwan_checkout_address_options', array $options, int $user_id, string $type ): array
```

Each option contains `id`, `name`, `description`, `street`, `details`, `isDefault`, `defaultRoles`, `selectLabel`, and `fields`. Both checkout contexts receive the same set; only ordering and `isDefault` depend on `$type` (`"billing"` or `"shipping"`).

### `unwan_address_type_enabled`

Filters whether a checkout selector is enabled.

```php theme={null}
apply_filters( 'unwan_address_type_enabled', bool $enabled, string $type ): bool
```

### `unwan_address_save_limit`

Filters the shared additional-address limit. Return `0` for unlimited.

```php theme={null}
apply_filters( 'unwan_address_save_limit', int $limit, int $user_id ): int
```

Lossless default swaps may preserve a displaced default beyond this limit — see [Default Swaps](/unwan/concepts/default-swaps-and-duplicates).

<CodeGroup>
  ```php example.php theme={null}
  // Give wholesale customers a higher limit.
  add_filter( 'unwan_address_save_limit', function ( $limit, $user_id ) {
      if ( user_can( $user_id, 'wholesale_customer' ) ) {
          return 25;
      }

      return $limit;
  }, 10, 2 );
  ```
</CodeGroup>

### `unwan_address_search_threshold`

Filters the saved-address count above which search appears in checkout and My Account. Return `0` to always show it.

```php theme={null}
apply_filters( 'unwan_address_search_threshold', int $threshold ): int
```

### `unwan_save_checkout_addresses`

Filters whether a validated address entered at checkout is saved to the address book.

```php theme={null}
apply_filters( 'unwan_save_checkout_addresses', bool $enabled ): bool
```

### `unwan_update_checkout_default`

Filters whether a new saved checkout address replaces its matching billing or shipping profile default.

```php theme={null}
apply_filters( 'unwan_update_checkout_default', bool $update ): bool
```

Has no effect when checkout-address saving is off.

### `unwan_color_scheme`

Filters the storefront color mode. Supported results are `light`, `dark`, and `system`; anything else falls back to `light`.

```php theme={null}
apply_filters( 'unwan_color_scheme', string $scheme ): string
```

### `unwan_accent_color`

Filters the sanitized six-digit accent color. Invalid results fall back to `#6b3fa0`.

```php theme={null}
apply_filters( 'unwan_accent_color', string $color ): string
```

### `unwan_account_labels`

Filters My Account labels: `pageTitle`, `pageDescription`, `addAddress`, `addHeading`, `editHeading`, `backToAddresses`, `saveAddress`, `cancel`, `emptyHeading`, `emptyDescription`.

```php theme={null}
apply_filters( 'unwan_account_labels', array $labels ): array
```

### `unwan_checkout_picker_labels`

Filters shared picker labels: `address`, `billingCompactHeading`, `shippingCompactHeading`, `billingPanelHeading`, `shippingPanelHeading`, `savedAddress`, `savedAddresses`, `moreAddress`, `moreAddresses`, `searchLabel`, `searchPlaceholder`, `noResults`, `newAddress`, `default`, `change`.

```php theme={null}
apply_filters( 'unwan_checkout_picker_labels', array $labels ): array
```

<Note>
  Count labels (`savedAddress(es)`, `moreAddress(es)`) must retain their `%d` placeholder.
</Note>

### `unwan_checkout_block_picker_data`

Filters the private data payload sent to the Checkout Blocks picker.

```php theme={null}
apply_filters( 'unwan_checkout_block_picker_data', array $data, int $user_id ): array
```

### `unwan_classic_checkout_picker_data`

Filters the private data payload sent to the classic-checkout picker.

```php theme={null}
apply_filters( 'unwan_classic_checkout_picker_data', array $data, int $user_id ): array
```

### `unwan_admin_settings`

Filters the settings array shown on the Accounts & Privacy → Unwan subsection.

```php theme={null}
apply_filters( 'unwan_admin_settings', array $settings ): array
```

## Actions

### `unwan_addresses_saved`

Fires after the shared additional-address collection is persisted — useful for cache invalidation or sync hooks that need to react to any address-book mutation.

```php theme={null}
do_action( 'unwan_addresses_saved', int $user_id, array $records )
```


## Related topics

- [Settings Reference](/unwan/settings.md)
- [Quickstart](/unwan/quickstart.md)
- [JavaScript API](/unwan/developers/javascript-api.md)
- [CSS Variables & Markup](/unwan/customization/css-and-markup.md)
- [Appearance & Theming](/unwan/customization/appearance-and-theming.md)
