Skip to content

Apps that change the cart

How an app can tell the theme that the cart changed, so the cart count, drawer and cart page refresh.

An app that adds to the cart with Shopify’s Ajax API sends this event after its change:

document.dispatchEvent(new CustomEvent('cart:refresh'))
  • The theme itself sends cart:change after each of its own cart changes.
  • To add an app’s own block to the cart page, use Add block → Apps in the Cart section. See App blocks and app embeds.