Alokai

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

NameRequiredTypeDescription
propsRequiredAddLineItemsParametersParameter object which can be used with this method. Refer to its type definition to learn about possible properties.
optionsOptionalMethodOptions

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
      }
    ]
  }
})

On this page