AJAX cart requests

How Kaching Cart reacts to Shopify Cart AJAX API requests, and how to opt a request out.

Cart docs

Kaching Cart automatically listens for requests sent to Shopify's Cart AJAX API so the drawer stays in sync with the customer's cart — whether the request comes from the theme, a page builder, or a third-party app.

Endpoints that are watched

Kaching Cart watches POST requests to these Shopify Cart AJAX API endpoints:

  • /cart/add.js
  • /cart/update.js
  • /cart/change.js
  • /cart/clear.js

The .js suffix is optional, and a single locale segment is also recognized (for example /en/cart/add or /fr-ca/cart/update.js).

When one of these requests completes, Kaching Cart will — depending on the merchant's app settings — refresh its cached cart data and open the cart drawer so the customer sees their updated cart.

Opting out

If you're making a Cart AJAX request from your own code and you don't want the default behavior, append a query parameter to the request URL.

Don't open the drawer

Add opens_cart=never to the request URL. Kaching Cart will still refresh its cart data so the drawer reflects the change the next time it opens, but the drawer will not pop open as a result of this request.

javascript
await fetch("/cart/add.js?opens_cart=never", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ id: variantId, quantity: 1 }),
});

opens_cart=false and opens_cart=0 behave identically — use whichever reads best in your code.

Ignore the request entirely

Add kaching_cart_ignore=true to the request URL. Kaching Cart will not refresh, will not open the drawer, and will not dispatch any cart events for this request — it passes through completely untouched.

javascript
await fetch("/cart/add.js?kaching_cart_ignore=true", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ id: variantId, quantity: 1 }),
});

Use this when you have a special-purpose cart request that should not affect the visible cart UI at all.

Can’t find what you need?

Ask the Kaching team about your integration in chat.