Shopify Cart Not Removing Items? Fixing the 'Section Header Not Found' Error
Ever run into that frustrating situation where your Shopify cart just won't behave? You click to remove an item, and it either stubbornly stays put, or the cart total remains completely wrong until you refresh the whole page. It's a common headache, and one that popped up recently in the community, sparking a really insightful discussion about the dreaded 'Section header not found' error.
Our fellow merchant, SushiShark, hit this exact wall. They had built a cool bundle maker, but after sprucing up the cart's look with some CSS for cart-summary, cart-products, and cart-preview, items refused to disappear properly. The console was screaming:
section-renderer.js:171 Uncaught (in promise) Error: Section header not found If this sounds familiar, you're in the right place!
Understanding the 'Section Header Not Found' Cart Error
First off, let's clear something up: as HamidEjaz and others in the thread pointed out, this isn't usually a problem with your bundle discount logic itself. While SushiShark's bundle setup was the context, the core issue lies deeper in how Shopify themes, especially newer ones like Dawn or those built on its 'Horizon' architecture, handle cart updates.
Modern Shopify themes use a component-based approach. When you change a quantity or remove an item in your cart, the cart doesn't do a full page reload. Instead, it cleverly fetches just the updated cart section from the server and uses JavaScript – specifically a function called morphSection() – to 'morph' or swap in only the parts of the page that have changed. It's super efficient, but it relies on a very specific HTML structure.
The 'Section header not found' error means that when Shopify's JavaScript tried to find the designated 'root wrapper' or 'section container' for the cart (the element with the section ID, or a custom element like cart-items-component), it simply wasn't there in the freshly rendered HTML. As WebsiteDeveloper rightly summarized, it's a "cart section markup issue." This breaks the morphSection() process, leaving your cart in a confused state until a full page refresh manually re-renders everything server-side.
So, while SushiShark thought they were just tweaking CSS, the consensus from experts like markjohn1 and tim_tairli was clear: you've likely (and perhaps accidentally) altered the underlying Liquid or HTML structure of your cart files. This could mean removing, renaming, or wrapping a critical element inside another div, or even leaving an HTML tag unclosed.
Diagnosing the Cart Markup Problem
Before jumping to solutions, it's good to confirm the culprit. Here's how you can narrow it down, incorporating suggestions from webiots and others:
- Verify the Error: You've probably already done this, but open your browser's Developer Console (usually F12 or right-click > Inspect) and look for JavaScript errors when you try to remove an item. If you see variations of
, you've got the exact issue.section-renderer.js:171 Uncaught (in promise) Error: Section header not found - Identify Modified Files: Think back to what you've recently touched. For cart issues, this usually involves files like
sections/cart-template.liquid,blocks/cart-products.liquid,blocks/cart-summary.liquid,sections/main-cart-items.liquid, or even files related to a cart drawer (e.g.,sections/cart-drawer.liquid). - Test with an Unmodified Theme: This is a quick way to rule out app conflicts. In your Shopify Admin, go to "Online Store" > "Themes." Find an unedited theme (like a fresh Dawn install), click "Actions" > "Preview," and test your cart. If it works perfectly there, the issue is definitely in your current theme's code.
- Consider App Conflicts: As webiots mentioned, if you've installed any recent apps that modify the cart (upsells, bundle apps, cart drawers), try temporarily disabling them one by one. While less likely for the 'Section header not found' error, it's a good general troubleshooting step.
The Step-by-Step Fix: Restoring Your Cart's Structure
The most reliable fix, as detailed by HamidEjaz, is to restore the original markup and then reapply your visual styling carefully.
- Duplicate Your Theme (Crucial!): Always, always, always duplicate your live theme before making code changes. Go to "Online Store" > "Themes," find your current theme, click "Actions" > "Duplicate." Work on this copy. If anything goes wrong, you can just delete the copy and your live site remains untouched. This is good practice for any Shopify store owner looking to customize their Shopify presence.
- Access the Code Editor: In your duplicated theme, click "Actions" > "Edit code."
- Identify and Revert Problematic Files: Navigate to the files you suspect you altered (e.g.,
sections/main-cart-items.liquid,blocks/cart-products.liquid,blocks/cart-summary.liquid). - Restore Older Versions: For each problematic file, click on the three-dot menu next to its name in the code editor. Select "Older versions." You'll see a history of changes. Restore the file to a version *before* you started making your cart styling edits.
- Test the Cart: Save your changes and preview your duplicated theme. Add items to the cart and try removing them. If the 'Section header not found' error is gone and items remove correctly, you've found the culprit!
- Reapply CSS Safely: Now that your cart markup is restored, you can reapply your visual changes. The key here is to apply them as CSS only. Put your custom CSS in your theme's main CSS asset (e.g.,
assets/base.cssorassets/theme.css) or within ablock in the relevant Liquid file. Crucially, do not alter the HTML structure of the section root or the custom cart elements. Target existing classes and IDs with your CSS, but leave the Liquid markup exactly as Shopify intended.
This process ensures that Shopify's JavaScript can find all the necessary elements for its dynamic updates, while still allowing you to achieve the visual style you want. It's a delicate balance between customization and preserving core theme functionality. Pay close attention to those root wrappers and section IDs – they're the unsung heroes of a smoothly functioning cart!