JavaScript API


A read-only property of the liquidAjaxCart object, which returns the current cart state data.

How it works

After each successful Shopify Cart API Ajax request, Liquid Ajax Cart retrieves the cart state data from the response and saves it the in the liquidAjaxCart.cart property. If a request is successful but the response doesn’t have the cart state data (the /cart/add.js response is the case), Liquid Ajax Cart performs an additional /cart/update.js request to get the data.

Use the liquidAjaxCart.cart property to read the latest cart state data.

As the cart state data is updated after a Shopify Cart API Ajax request, subscribe to the liquid-ajax-cart:request-end event if you want to run your JavaScript code when the cart state is updated.