Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

getUserAddresses

Get customers addresses from SAP Commerce Cloud.

This method exchanges data with the getAddresses endpoint exposed by the SAP OCC API Address Controller.

The method fetches customer addresses based on the vsf-sap-token cookie (which is assigned to that customer). The cookie must be present in the request for the method to work properly.

Signature

export declare function getUserAddresses(
	context: SapccIntegrationContext,
	props?: BaseProps & BaseUserId
): Promise<AddressList>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsOptionalBaseProps & BaseUserIdParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of an Address List.

Referenced Types

Examples

Fetching customer addresses.

import { sdk } from '~/sdk';

const { addresses } = await sdk.commerce.getUserAddresses();

Fetching customer addresses and selecting response fields.


const \{ addresses \} = await sdk.commerce.getUserAddresses(\{ fields: 'addresses(firstName,lastName)' \}); `*

On this page