A user is experiencing a conflict between a custom cart popup and their theme’s built-in AJAX drawer cart, both triggering simultaneously when adding products to cart. The theme lacks a native option to disable the default cart.
Proposed Solutions:
JavaScript Override: Insert custom code in theme.liquid before the closing </body> tag to intercept and prevent the default drawer cart behavior
Manual Code Removal: Locate and comment out drawer-triggering code in files like cart-drawer.liquid, cart.js, or similar JavaScript files that handle fetch('/cart/add.js') callbacks
Key Technical Points:
Look for functions like this.cartDrawer.open() or document.dispatchEvent(new CustomEvent('cart:updated')) and disable them
Avoid using data-cart-trigger attributes to prevent conflicts
Check theme files: global.js, product-form.js, or cart.js
Current Status: The issue remains unresolved, with the wrong cart still appearing when products are added.
Summarized with AI on October 28.
AI used: claude-sonnet-4-5-20250929.
I have a custom cart that pops up after pressing add to cart, but the themes own cart also comes up, which I do not want. I know some themes have the “disable ajax cart” option, but my current theme doesn’t show that option when I click on the buy button.
Yes, you can disable the built-in AJAX drawer cart in your Shopify theme with a bit of custom code. Since your theme doesn’t offer a native toggle for the AJAX cart, you’ll need to prevent the default cart drawer behavior from running when the product is added to the cart.
Here’s how to do it:
Option 1: Prevent AJAX drawer cart with JavaScript override
You can intercept the default behavior by overriding the Shopify.addItem event or disabling the drawer code from executing.
Open your theme.liquid or the main layout file.
Just before the closing tag, insert this script:
Option 2: Remove or comment out drawer cart code (if possible)
If your theme has a section or snippet like cart-drawer.liquid, you can:
Go to Online Store > Themes > Edit code.
Look for files like:
. cart-drawer.liquid
. cart.js
. or JavaScript that listens for fetch(‘/cart/add.js’) and triggers the drawer
Comment out or remove the function that triggers the drawer popup (often inside a callback to fetch or XMLHttpRequest on add-to-cart).
Pro Tip
To avoid conflicts:
. Make sure you’re not using the data-cart-trigger attribute anywhere.
. Look in the theme’s global.js, product-form.js, or cart.js for any lines like: