For the complete documentation index, see llms.txt. This page is also available as Markdown.

Open the widget from a menu link

By default the cashback widget lives behind a floating launcher in the page corner. Some stores would rather not have a floating button at all: it can sit on top of chat widgets, cookie banners, or your own navigation. This recipe removes the launcher and opens the same panel from a permanent entry point you control, such as a header menu item or an icon in your announcement bar.

The panel itself does not change. Customers still get the full Home / Offers / Referral experience; only the way they open it moves.

Keep the Cashback Widget app embed enabled. The embed renders the panel; this recipe only hides the launcher button. If you disable the embed, there is nothing left to open.

How it works

The storefront bundle exposes window.dollarlabs.dollarback.openWidget(), which opens the panel from any JavaScript on the page. So the recipe is three small steps:

  1. Hide the floating launcher with widget custom CSS.

  2. Add a menu item that acts as the new entry point.

  3. Add a few lines of JavaScript that call openWidget() when that menu item is clicked.

Step 1. Hide the floating launcher

  1. Go to DollarBack admin β†’ Customization β†’ Cashback widget and open the Advanced tab.

  2. In the Custom CSS field, add:

.dbw-trigger {
  display: none;
}
  1. Save.

The launcher button doubles as the panel's close button, so with it hidden customers close the panel by clicking anywhere outside it or pressing Escape. If you want the button to reappear as a close control while the panel is open, use this instead:

Step 2. Add the menu item

  1. In Shopify admin, go to Online Store β†’ Navigation and open the menu you want (usually the main menu).

  2. Add a menu item named for example Rewards, and set its link to #rewards.

  3. Save the menu.

The #rewards link is just a marker for the script in the next step; on its own it does nothing. Any anchor value works as long as the script below matches it.

Step 3. Wire the click to the widget

Add this script to your theme. The easiest home for it is a Custom Liquid section or block placed in the theme's footer; pasting it into theme.liquid just before </body> also works.

This listens for clicks on any link ending in #rewards (your new menu item), stops the browser from jumping to the anchor, and opens the panel. The guard around the call means a click during the first moments of page load, before the DollarBack bundle has finished loading, is safely ignored instead of throwing an error.

If you are wiring up your own button rather than a menu link, you can call the API directly:

openWidget() accepts an options object, so different menu items can open different parts of the panel:

Call
Opens

openWidget()

The Home tab

openWidget({ tab: "offers" })

The Offers tab

openWidget({ tab: "referral" })

The Referral tab

openWidget({ view: "redeem" })

The redeem rewards view

openWidget({ view: "history" })

The reward history view

openWidget({ configId: "..." })

The Offers tab, scrolled to that cashback offer with a brief highlight

The full API, including the equivalent dollarback:open-widget event, is documented in the Storefront window API reference.

If you would rather not add any script, point the menu item at your loyalty page instead. It is a full page with the same balance, earning, and redemption content, and a plain menu link reaches it with no JavaScript. See Set up the loyalty page.

Verify it works

  1. Open your storefront: the corner launcher should be gone.

  2. Click the new menu item: the panel should open in place instead of navigating.

  3. Click outside the panel (or press Escape) to close it.

  4. Sign in as a test customer and repeat; the panel should show their balance as usual.

Common issues

  • Clicking the menu item jumps to the top of the page instead of opening the panel: the script isn't on the page (the Custom Liquid section was removed or is only on some templates), or the href in the script doesn't match the menu item's link.

  • Nothing happens at all: the Cashback Widget app embed is off. The launcher CSS only hides the button; the embed must stay enabled. See A widget isn't showing on my store.

  • The launcher is still visible: the CSS was added somewhere else, such as the theme editor. It must go in the Custom CSS field under Customization β†’ Cashback widget β†’ Advanced, which loads with the widget itself.

Last updated