JavaScript API


A boolean read-only property of the liquidAjaxCart object, which becomes true once Liquid Ajax Cart is initialized.

Use case

Use this property along with the liquid-ajax-cart:init event when you want to run your JavaScript once Liquid Ajax Cart is initialized.

function runWhenInit() {
  console.log("The current cart state is: ", window.liquidAjaxCart.cart);

if (window.liquidAjaxCart?.init) {
  // if Liquid Ajax Cart is already initialized
} else {
  // wait for Liquid Ajax Cart to be initialized
  document.addEventListener("liquid-ajax-cart:init", runWhenInit);