Home > @vsf-enterprise/sap-commerce-webservices-sdk > CartsApi > createCart
CartsApi.createCart() method
Creates a new cart or restores an anonymous cart as a user's cart (if an old Cart Id is given in the request). Creates or restore a cart for a user.
Signature:
createCart(baseSiteId: string, userId: string, fields?: 'BASIC' | 'DEFAULT' | 'FULL', oldCartId?: string, toMergeCartGuid?: string, options?: any): Promise<import("axios").AxiosResponse<Cart>>;
Parameters
Parameter | Type | Description |
---|---|---|
baseSiteId | string | Base site identifier |
userId | string | User identifier or one of the literals : 'current' for currently authenticated user, 'anonymous' for anonymous user |
fields | 'BASIC' | 'DEFAULT' | 'FULL' | Response configuration. This is the list of fields that should be returned in the response body. |
oldCartId | string | Anonymous cart GUID. |
toMergeCartGuid | string | The GUID of the user's cart that will be merged with the anonymous cart. |
options | any | Override http request option. |
Returns:
Promise<import("axios").AxiosResponse<Cart>>
Exceptions
{RequiredError} CartsApi