Home > @vue-storefront/magento-api > addProductsToCart

addProductsToCart() function

Adds products to the specified cart

Signature:

export default function addProductsToCart(context: Context, input: AddProductsToCartInput, customQuery?: CustomQuery, customHeaders?: CustomHeaders): Promise<FetchResult<AddProductsToCartMutation>>;

Parameters

Parameter Type Description
context Context VSF Context
input AddProductsToCartInput ID of the cart and products to be added
customQuery CustomQuery (Optional) (optional) - custom GraphQL query that extends the default one
customHeaders CustomHeaders (Optional) (optional) - custom headers that extends the default headers

Returns:

Promise<FetchResult<AddProductsToCartMutation>>