createAddress
Creates a new saved address with the given id for the signed-in customer.
This method communicates with the createAddress endpoint of the Vue Storefront API Middleware. In turn, it receives data from the createCustomerAddress or the Create customer address endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Signature
export declare function createAddress(
props: CustomerCreateAddressParams
): Promise<import("commerce-sdk/dist/customer/customer").ShopperCustomers.CustomerAddress>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | CustomerCreateAddressParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a Customer Address.
Referenced Types
CustomerCreateAddressParamsShopperCustomers.CustomerAddress
Examples
Creating a saved customer address.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.createAddress({
addressId: 'Home',
countryCode: 'US',
});