I understand that when an app needs to update the cart DOM, it can use the Section Rendering API or Bundled section rendering by specifying a section_id.
However, in one theme, the cart drawer appears to be outside the main section and footer section, and it does not seem to have a section ID (cart-drawer) that can be passed in the sections parameter.
In this case, how should an app update or re-render the cart drawer DOM?
Is there a recommended Shopify-supported approach for themes where the cart drawer is not available through the Section Rendering API?
Adding to Luke’s reply: like Luke said, not every theme exposes the cart drawer as a renderable section, so there’s no universally safe section ID to pass. The pattern most apps land on is a best-effort section list, e.g. passing sections=cart-drawer,cart-notification,cart-icon-bubble,header to the Cart Ajax API; unknown IDs are silently ignored, and you swap in whichever sections actually came back.
For Dawn-family themes, the cleaner approach is to let the theme re-render itself after your /cart/*.js call and subscribe to its cart:updated / pub-sub events rather than mutating the DOM directly. When nothing renders (older or heavily customized themes), most apps fall back to a hard navigation to /cart. Many app devs will document a supported theme list and ask merchants using different or custom builds to involve their theme dev if possible. Let me know if I can clarify anything on our end here.
That makes sense. We were currently updating the cart DOM directly from the app side, so it’s very helpful to know that, especially for Dawn-family themes, it’s better to rely on the theme’s own re-rendering flow and cart update events where possible.
We’ll adjust our implementation to use a best-effort section list, handle only the sections that are returned, and fall back appropriately for themes where the cart drawer is not renderable.