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:
- Edit the cart-drawer.js script to preserve the existing upsell section.
- Run whatever script sets up the upsell section when the cart drawer is rerendered.
- 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.