Event

liquid-ajax-cart:queue-end

An event which is fired at the document when a Liquid Ajax Cart has executed all the Shopify Cart API Ajax requests from the Queue and it is switching back to the “idle” mode.

How it works

Liquid Ajax Cart doesn’t perform Shopify Cart API Ajax requests immediately, it adds them to the Queue. When a request is executed, it is removed from the Queue. If there is no other request to perform, Liquid Ajax Cart triggers the liquid-ajax-cart:queue-end event.

The detailed explanation on when each event is fired and what exactly happens before and after each event is in the “Lifecycle, events, API” guide.

document.addEventListener("liquid-ajax-cart:queue-end", function() {
  console.log("A queue of requests is finished");
  console.log("The current cart state is: ", window.liquidAjaxCart.cart);
});

Use cases

Use this event when you want to:

  • modify the page content when Liquid Ajax Cart has executed all the Shopify Cart API Ajax requests and switching back to the “idle” mode;
  • modify the cart state by performing an additional Shopify Cart API Ajax request based on a particular rule.

Code examples with this event: