Close Cart Overlay
Closes the cart drawer and keeps Vaul and the Anopa drawer store in sync.
AP_CloseCartOverlay closes the cart drawer when clicked and keeps both the Vaul drawer library and the Anopa drawer store in sync.
What it does
AP_CloseCartOverlay closes the cart drawer when the user clicks the icon or overlay. It calls Drawer.Close from the Vaul drawer library and closeCart() from the Anopa drawer store so that both the UI drawer and the plugin state stay synchronized. On the canvas and in preview, it renders the icon directly without relying on the Vaul Drawer context to avoid runtime errors.
How to set it up
Place AP_CloseCartOverlay inside your cart drawer design, typically in the header next to a close icon or title. You can use the built-in fallback SVG icon or connect your own custom icon component by enabling the Use Custom Icon control and assigning a Custom Icon instance.
Key behaviours
- Calls Drawer.Close from the Vaul drawer library at runtime to close the cart drawer.
- Also calls closeCart() from the Anopa drawer store to keep plugin state in sync.
- On canvas and in preview, renders the icon directly without requiring Drawer context, preventing errors when the Vaul drawer is not mounted.