Configuration

data-ajax-cart-configuration

Add a script tag with the data-ajax-cart-configuration attribute and a JSON object with configuration parameters inside to set initial configuration of Liquid Ajax Cart:

{% comment %} Somewhere in layout/theme.liquid {% endcomment %}

<script type="application/json" data-ajax-cart-configuration >
  {
    "requestErrorText": "{{ 'general.request_error' | t }}",
    "updateOnWindowFocus": true
  }
</script>

It is highly recommended to add the script to the layout/theme.liquid file to make the configuration accessible on all pages.

This method doesn’t support the productFormsFilter and the messageBuilder parameters. To set them up use the configureCart function that supports all the parameters.

configureCart()

The function takes a configuration parameter and its new value:

<script type="module">
  import { configureCart } from '{{ "liquid-ajax-cart-v1.10.3.js" | asset_url }}';

  configureCart('requestErrorText', 'My request error text');
  configureCart('productFormsFilter', formNode => formNode.hasAttribute('data-my-product-form'));
</script>

Reference