Events

Cart state changes

Listening to cart state changes can be made by listening to the changed-cart event.

window.addEventListener("changed-cart", myFunction);

function myFunction(event) {
  const cart = event.detail;
  //--
}

Cart interface structure

interface CartItem {
  id: number;
  sku: string;
  name: string;
  children: object[];
}
interface Cart {
  cart_id: string;
  items: CartItem[];
}