DAWN Cart update issue

Topic summary

A user is experiencing an issue with a custom cart-upsell-module section in the Dawn theme. When cart quantity or remove buttons are clicked in the cart drawer, all sections update except the upsell module, causing it to break visually.

Root Cause:
The cart-drawer.js file uses Shopify’s Section Rendering API to replace the entire cart drawer contents when changes occur. This creates a new instance of the upsell section, breaking previously attached JavaScript event listeners.

Proposed Solutions:

  • Modify cart-drawer.js to preserve the existing upsell section during updates
  • Re-run the upsell section’s setup script after each cart drawer re-render
  • Rebuild the section using JavaScript custom elements, which automatically reinitialize when rendered

Status: The issue remains unresolved with multiple implementation paths suggested.

Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Hello, when quantity button/remove product button is clicked in my cart-drawer it updates all my sections from my cart except for my new section: cart-upsell-module. I’m using DAWN Theme, how do I add this section to be updated when the cart contents are changed? URL: Glow Curtain: 400 LED Lights for a Magical Ambiance – InteriorGlows

The green section gets ruined when one of the blue buttons is clicked. This is because the buttons do not update the section after clicking I believe.

Kind regards,

stef

Have a look at the cart-drawer.js file for the Dawn theme. When a change is made to the cart, it uses the Shopify section rendering API to replace the entire contents of the cart drawer. When this happens, you bring in a new copy of the upsell section. Any previously connected JavaScript events will not apply to this new section, and new ones are not being added.

Some solutions here are to:

  1. Edit the cart-drawer.js script to preserve the existing upsell section.
  2. Run whatever script sets up the upsell section when the cart drawer is rerendered.
  3. If this is a section you built yourself, consider rebuilding it using JS custom elements. Then, they will be set up again every time they are rendered in the document.