Events

Cart mounted

Listening to the cart mounted event can be made by listening to the circuly-cart-mounted event.

const onMounted = (event) => {
    console.debug("Cart mounted!")
    // 
}

window.addEventListener("circuly-cart-mounted", onMounted);

Cart changed

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

const onChanged = (event) => {
    console.debug("Cart changed!", event.detail)
    // 
}

window.addEventListener("circuly-cart-changed", onChanged);

Cart interface structure

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