Home > @vsf-enterprise/bigcommerce-theme > UseCartInterface

# UseCartInterface interface

Data and methods returned from the useCart() composable

Signature:

export interface UseCartInterface 

# Properties

Property Type Description
error Ref<UseCartErrors> Contains errors from the composable methods.
loading Ref<boolean> Indicates whether any of the methods is in progress.

# Methods

Method Description
addItem(product, quantity, variantId) Takes in a product, its quantity and variantId and adds it to the cart.
clear() Removes all items from the cart and create new, empty cart.
isInCart(product) Checks whether a product is in the cart.
load(forceNew) Loads the current cart.
loadCustomerCart() Loads the cart for current customer.
removeItem(cartItem) Removes an cartItem from a cart.
updateItemQty(cartItem, quantity) Updates the quantity of an cartItem in a cart