Storefront Events: Redirect After a Quote and Custom Open Button
For merchants with a theme developer, or when BSS support helps with your theme. The app fires events on the storefront that your theme code can listen to. You do not need a library or any change to the app.
The events are dispatched on document.head and bubble up to document, so document.addEventListener works.
Redirect to a thank-you page after a quote is sent
Section titled “Redirect to a thank-you page after a quote is sent”The event bcpR4q:submitQuoteSuccess fires as soon as a quote is sent successfully, before the form shows its thank-you step. It has no detail (no quote ID). If you redirect immediately, customers will not see the thank-you step, so wait a few seconds.
<script> document.addEventListener("bcpR4q:submitQuoteSuccess", function () { setTimeout(function () { window.location.href = "/pages/thank-you-quote"; // use a page of your own shop }, 2500); });</script>Add it to theme.liquid before </body> (or in the theme’s custom code section). Use a path of your own shop only. Never build the URL from visitor input.
Open the quote form from your own button
Section titled “Open the quote form from your own button”Every built-in entry point of the app (the floating widget, the “view quote” toast) fires the same event, bcpR4q:openForm. A custom button, for example a quote icon in your header, can do the same:
<script> document.addEventListener("click", function (event) { if (!event.target.closest(".my-quote-icon")) return; // class of your custom button event.preventDefault(); document.head.dispatchEvent( new CustomEvent("bcpR4q:openForm", { bubbles: true, composed: true, detail: {} }) ); });</script>Things to know:
- The form lists the products the customer already added to the quote list (with the quote button on a product or collection page). With an empty list there is nothing to send.
- The form only opens on pages where Request for Quote runs for that customer. On other pages nobody listens to the event.
- To close the form from code, fire
bcpR4q:closeFormthe same way. - If the floating widget covers another button (for example Checkout on mobile), hide the widget with the display conditions in the app and use your own button as above.
When to ask support
Section titled “When to ask support”If your theme overrides scripts, uses an unusual ajax cart or lazy loading, or you need another event (for example the quote ID after sending), contact support instead of editing app code.
- Quote settingsSet up quote notifications and email templates, the sender email, quote reminders, the quote PDF and the quote history page.
- Quote Button Placement and Supported ThemesFix a quote button that sits in the wrong place: check if your theme is supported, set a CSS selector per page, reset to the theme preset, and see which themes have a preset.
- Full Setup GuideSet up Request for Quote end to end: create a quote logic, set visibility, catalogs, the quote button and form, then review and convert quotes.
- Hide Price & Add to CartHide prices and the Add to cart button for quoted products, and combine this with BSS B2B Lock and custom pricing from BSS B2B Solution.