CartItem Object

CartItem represents a single item (product variety) in cart.

Get quantity of a product in cart example:

Ecwid.OnCartChanged.add(function(cart) {
  console.log("There are " + cart.items[0].quantity + " items of " + cart.items[0] + " in cart now.");

// prints
// There are 1 items of Apple product in cart now.

Subscribe to the Ecwid.OnAPILoaded JS API event to ensure availability of this function.


quantityintegerQuantity of the given product variety in cart
productArray <Product>The map of product properties (variation properties, if the variation is added to cart)
optionsObject with option names and valuesMap of the product options (option name as a key and option value as a value). For listboxes and radio buttons value will be the string value of the selected option. For checkboxes — names of the selected options, comma separated. For date options — string representing the selected date according to the shop’s format (Ecwid control panel > System settings > General > Formats and Units). For textboxes и textareas — the text given by the customer. For file upload options — string in the form of „4 files”