setBasketCustomerInfo
Sets customer information for an existing basket.
This method communicates with the setBasketCustomerInfo endpoint of the Vue Storefront API Middleware. In turn, it receives data from the updateCustomerForBasket or the Update customer of basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Signature
export declare function setBasketCustomerInfo(
props: BasketCustomerInfoSetParams & {
basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.Basket>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | BasketCustomerInfoSetParams & { basketId?: string; } | 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 Category Hierarchy.
Referenced Types
BasketCustomerInfoSetParamsShopperBaskets.Basket
Examples
Set customer information for an existing basket with required fields only by email.
import { sdk } from '~/sdk.config.ts';
const basket = await sdk.commerce.setBasketCustomerInfo({ email: testEmail@provider.com });Set customer information for an existing basket for a specific basket by BasketCustomerInfoSetParams.
import { sdk } from '~/sdk.config.ts';
const props = {
customerId: '00001',
customerName: 'John Doe',
email: testEmail@provider.com;
basketId: 'basketId'
}
const basket = await sdk.commerce.setBasketCustomerInfo(props);