addCartItems
Adds items to the cart.
This method sends a POST request to the addCartItems endpoint of the Vue Storefront API Middleware. In turn, it receives data from the addCartItems endpoint exposed by the BigCommerce API
Signature
declare function addCartItems$1(
props: AddLineItemsParameters,
options?: MethodOptions
): Promise<AddLineItemsResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | AddLineItemsParameters | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions |
Returns
Returns a response of a cart that contains a collection of items, prices, discounts, etc. It does not contain customer-related data.
Referenced Types
Examples
Adding a line item to the cart
import { sdk } from '~/sdk.config.ts';
const addCartItem = await sdk.bigcommerce.addCartItems({
data: {
cartId: '7c3ab631-782c-4747-8ccc-873e87de5152',
line_items: [
{
product_id: 112,
quantity: 1
}
]
}
})