You are reading the documentation for SDK v2, which is no longer the latest version. Switch to current
addToCart
Endpoint for adding product to the provided cart. By default, it uses the updateCartDefaultQuery GraphQL query
Signature
export declare function addToCart(
context: SetupContext,
cart: AddToCartParams,
params: AddToCartProductParams,
customQuery?: CustomQuery,
responseOptions?: ResponseOptions
): Promise<AddToCartResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SetupContext | Automatically injected context. Refer to SetupContext |
cart | Required | AddToCartParams | Cart object |
params | Required | AddToCartProductParams | Product, quantity and channel information |
customQuery | Optional | CustomQuery | Custom queries included in the request |
responseOptions | Optional | ResponseOptions |
Returns
User cart information