Home > @vsf-enterprise/commercetools-api > addToCart

# addToCart() function

Endpoint for adding product to the provided cart. By default, it uses the updateCartDefaultQuery GraphQL query

Signature:

export declare function addToCart(context: Context, cart: AddToCartParams, params: AddToCartProductParams, customQuery?: CustomQuery): Promise<AddToCartResponse>;

# Parameters

Parameter Type Description
context Context Automatically injected context. Refer to Context
cart AddToCartParams Cart object
params AddToCartProductParams Product, quantity and channel information
customQuery CustomQuery Custom queries included in the request

Returns:

Promise<AddToCartResponse>

User cart information