A Shopify developer is experiencing issues with a custom cart drawer not updating automatically after adding products via AJAX. The current implementation successfully adds items to the cart but requires manual updates to the cart drawer UI, leading to complications—especially when the cart is empty.
Current Problem:
Custom add-to-cart code works but doesn’t trigger the cart drawer refresh
Requires manual DOM manipulation and additional checks for cart state
Causes glitches when cart is empty
Code and live example provided via Codeshare link and product URL
Proposed Solutions:
Find and use the theme’s existing cart drawer trigger/hook (often in custom.js)
Utilize the theme’s default AJAX flow instead of custom implementation
Status:
The discussion has moved to private communication, with the original poster agreeing to pay for implementation assistance. A third participant later noted the cart appears to be working properly and offered an unrelated product recommendation app.
Summarized with AI on October 31.
AI used: claude-sonnet-4-5-20250929.
I got this code for adding products to cart and it works for adding the products to cart. But when the products are added to cart, the cart-drawer is NOT updating. This causes me to update everything myself, but I’m having some issues doing so. Also this causes a lot of extra checks like check if the cart is empty, and in the newly generated cart. Buttons only work when I create functions for the buttons, code: Feb 11 4:46 PM - Codeshare. Can someone please tell me if there is an easier way to update the cart drawer after adding items to cart, like the general ADD TO CART does on a product page. URL: Glow Curtain: 400 LED Lights for a Magical Ambiance – InteriorGlows.
Currently the code glitches a lot when the cart is empty, so if you are looking into this for me refresh a bit while adding items from the bundle.
Find the theme existing hook which trigger cart drawer and use it with your ajax call on success.
Check custom.js some themes developer define the reusable hooks there.
Use theme default ajax but for that you have to first understand the flow of it.
Hello @Guleria are you willing to do this for me because I cannot get it to work properly without changing all html which takes a LOT of time. I’m willing to pay you something for it, but please a reasonable price since this does not seem like a big issue to me?
Hey @TrendBlend , I see that your items are updating properly in the cart as well now:)
I was looking at your cart a couple of days ago, & couldn’t help but notice that you guys are showing any recommendations on your product pages or even the cart.
Wouldn’t you agree that in businesses like home decor, people like to be assisted in exploring products that are just right for them?
I’ve been building ConvertWise, which lets you do exactly this: show dynamic product recommendations inside your product pages and cart, offer free shipping above a certain threshold (instead of offering free shipping on everything) & encourage shoppers to place larger orders. (AOV can shoot by up to 30%, based on some of the results we’ve been seeing for a few stores that work with us)
Feel free to try the app for free or even check out our demo store.