Cart updates now show without a refresh
Adding from a Modulo product section now updates your theme's cart drawer, badge and cart page immediately, on Horizon and Dawn-family themes alike.
Adding a product from a Modulo section put the item in the cart, but on some themes nothing on the page changed until the shopper reloaded — the drawer could even open showing an empty cart while the header badge was already counting the item.
The cause was that our cart code only spoke Dawn's language. It looked for Dawn's cart elements, asked Shopify to re-render sections by Dawn's names, and announced the change with events Dawn listens for. On a Horizon storefront none of those exist, so every one of them did nothing — silently, because Shopify answers a request for a section that isn't there with an empty result rather than an error.
What changed:
- Section names now come from your theme, never from us. We ask your own cart components which sections they need, or read the section id straight off the page, so a theme that renames or moves its cart still refreshes correctly.
- Horizon and other current themes are now spoken to directly, using the event their cart components actually listen for. That drives the cart badge, the "items in cart" announcement, the drawer opening, and — the part that was most visible — the cart contents themselves.
- The cart count is read from the cart, not guessed from the item just added. A shopper holding three items who added one could previously see the badge drop to one.
- Product Buy Box adds in place. It used to hand the click to the theme and hope; it now adds without a page load and refreshes the cart itself, while still working with JavaScript switched off.
- Opening the cart never navigates you away. On stores whose cart is a page rather than a drawer, a quick add updates the count and leaves the shopper where they were.
- On Horizon, your theme's "auto-open cart drawer" setting now decides whether the drawer slides open after a Modulo add, exactly as it does for your theme's own Add to cart button. Previously nothing opened at all on Horizon; now the choice is yours, in one place.
This affects Product Buy Box, Product Quick Buy, Product Shelf, Product Picks, Shop Tabs, Featured Products, Product Grid, Product Stage, Product Showcase, Shoppable Video and the Bundle block. Open the Sections catalog and choose Update to latest on any of these you have installed; your settings are kept. The Bundle block updates on its own with the app, nothing to do there.
Verified against two live Horizon 4.1.4 storefronts before release, with the theme's own cart components doing the measuring.