Alokai

updateCartItem

Updates an existing product in the the cart.

This method sends a POST request to the updateCartItem endpoint of the Vue Storefront API Middleware. In turn, it receives data from the updateCartItem endpoint exposed by the BigCommerce API

Signature

declare function updateCartItem(
	props: UpdateLineItemParameters,
	options?: MethodOptions
): Promise<UpdateLineItemResponse>;

Parameters

NameRequiredTypeDescription
propsRequiredUpdateLineItemParametersParameter 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

Updating a line item in the cart

import { sdk } from '~/sdk.config.ts';

const updateCartItem = await sdk.bigcommerce.updateCartItem({
  cartId: '7c3ab631-782c-4747-8ccc-873e87de5152',
  itemId: 'bd64d491-a4ac-4839-9fc2-5fc9f95a3bfd'
  data: {
    line_items:[{
      quantity: 2,
      product_id: 77
     }]
  }
})

On this page