Retrieves the cart contents asynchronously and passes it as an argument of type Cart to the callback. For more details see Cart Object

Get total number of products in cart code example

Ecwid.Cart.get(function(cart) {
  alert(cart.productsQuantity + " products in cart now");

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