Skip to main content

updateCustomerAddress

Update an existing customer address with validation.

Import

import { updateCustomerAddress } from "@evershop/evershop/customer/services";

Syntax

updateCustomerAddress(uuid: string, data: Partial<Address>, context?: Record<string, unknown>): Promise<Address>

Parameters

uuid

Type: string

Address UUID.

data

Type: Partial<Address>

{
full_name?: string;
address_1?: string;
address_2?: string;
city?: string;
province?: string;
postcode?: string;
country?: string;
telephone?: string;
is_default?: number;
}

context (optional)

Type: Record<string, unknown>

Additional context for hooks.

Return Value

Returns Promise<Address> with updated address.

Examples

Update Phone Number

import { updateCustomerAddress } from "@evershop/evershop/customer/services";

const address = await updateCustomerAddress('address-uuid', {
telephone: '+1-555-9999'
});

Set as Default Address

import { updateCustomerAddress } from "@evershop/evershop/customer/services";

await updateCustomerAddress('address-uuid', {
is_default: 1
});

Hooks

Supports hooks via registry:

  • customerDataBeforeUpdate - Modify data before update
  • updateCustomerAddressData - Hook address update

See Also