remarkOpenCart function to window.
When a shopper clicks the cart action in the Remark header, the widget checks for window.remarkOpenCart. If the function exists, Remark calls it and lets your site open its own cart drawer, modal, or cart page.
Add the cart opener
Add this code to the storefront pages where the Remark widget is installed.true, or returning no value, tells Remark that your storefront handled the action. Returning false tells Remark to fall back to the default checkout dialog.
The function can be synchronous or asynchronous. Define it before shoppers can
click the Remark cart action. If your cart script loads later, assign
window.remarkOpenCart after your cart script is ready.Function contract
Remark callswindow.remarkOpenCart with a single context object.
Open cart after recommendation add-to-cart
By default,remarkOpenCart only runs when a shopper clicks the cart button in the Remark header. It does not automatically open your cart after a shopper adds a recommended product to cart.
To also open your storefront cart after a user clicks the add-to-cart button on a recommendation, opt in with window.remarkOpenCartOnRecommendationAdd.
This opt-in only affects add-to-cart buttons on product recommendations shown
in chat. If
window.remarkOpenCart is missing, throws an error, or returns
false, Remark will not open a fallback cart after recommendation add-to-cart
since this isn’t the default behavior.Common patterns
Open a cart drawer by clicking the site’s cart button
Most storefronts already have a cart button that opens the cart drawer. In that case, reuse the existing button instead of duplicating cart logic.Call your storefront’s cart API
If your theme exposes a cart function, call it directly.Redirect to your cart page
If your site does not have a cart drawer or modal, send the shopper to the cart page.Fallback behavior
If the function is missing, throws an error, or returnsfalse, Remark opens the default checkout dialog.
Use this behavior intentionally: return false when your cart drawer cannot be opened, rather than leaving the shopper with no next step.
Test the integration
- Load a page with the Remark widget installed.
- Start a conversation.
- Add an item to your cart.
- Click the cart icon in the Remark header.
- Confirm your storefront cart opens.
- Temporarily return
falsefromwindow.remarkOpenCartand confirm Remark falls back to the default checkout dialog. - If you set
window.remarkOpenCartOnRecommendationAdd = true, add a recommended product to cart from chat and confirm your storefront cart opens.