getCustomer
Gets a customer with all existing addresses and payment instruments associated with the requested customer.
This method communicates with the getCustomer endpoint of the Vue Storefront API Middleware. In turn, it receives data from the getCustomer or the Get a Customer endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
You can use this method to fetch information about the currently signed-in customer. The ID of the customer is determined based on the provided JWT.
Signature
export declare function getCustomer(
): Promise<import("commerce-sdk/dist/customer/customer").ShopperCustomers.Customer>;Returns
Returns a representation of a Customer.
Referenced Types
ShopperCustomers.Customer
Examples
Fetching the current customer.
import { sdk } from '~/sdk.config.ts';
const customer = await sdk.commerce.getCustomer();