You're looking at the documentation for Liquid Ajax Cart v1. Go to Liquid Ajax Cart v2


@Kobi, especially for you.

The subscribeToCartSectionsUpdate function adds your callback function to the list of functions that will be called each time after data-ajax-cart-section sections HTML is updated.

The callback should be passed as the only parameter.

subscribeToCartSectionsUpdate( myCallback );
<script type="module">
  import { subscribeToCartSectionsUpdate } from '{{ "liquid-ajax-cart-v1.11.2.js" | asset_url }}'

  subscribeToCartSectionsUpdate( sections => {
    console.log('Sections are updated: ', sections);

Your callback will be called with an array of updated sections:

    "id": "my-cart",
    "elements": [ Element {} ]
    "id": "my-mini-cart",
    "elements": [ Element {}, Element {} ]
  • id — Shopify section’s name.
  • elements — an array of new data-ajax-cart-section HTML elements that replaced old ones. If the Shopify section is updated completely due to an error then the only item of the elements array will be the Shopify section’s HTML element.