Does Shopify.onCartUpdate function trigger with ajax product addition?

Topic summary

Core issue: Shopify.onCartUpdate does not consistently fire when items are added to cart via AJAX. Multiple users report no callback execution after assigning Shopify.onCartUpdate, seeking a reliable listener (including via ScriptTag).

Conflicting reports: One participant says it works in their setup; others confirm it never fires during AJAX add-to-cart, with screenshots showing no alerts.

Likely cause: Some themes do not use Shopify’s AJAX cart library to update the cart, so the Shopify.onCartUpdate callback is never triggered. Script load order may also matter; suggested placement is after vendor scripts but before the theme’s main script.

Workarounds and suggestions: Developers often “hijack” window.fetch to intercept cart update calls when themes bypass Shopify’s library. There’s a request for an official, supported event/API to avoid intercepting fetch.

Artifacts: Images/screenshots are used to show debugging steps and failed callback execution; they are relevant to understanding the troubleshooting.

Status: No definitive resolution. The best supported way to listen for cart updates (especially via ScriptTag) remains an open question and appears theme-dependent.

Summarized with AI on January 25. AI used: gpt-5.

Same here, it looks like everybody is hijacking the “fetch” function to intercept the calls, but Shopify should have an API to avoid that.