Loyalty Modal: Custom Launcher

Create a customized loyalty program launcher to stay on brand and offer a seamless customer experience.

Alexandru

Last Update vor 9 Tagen

Staying on brand is crucial, and offering customers a friendly way to access their loyalty program whenever and wherever is even more so!


This article provides an overview of the settings that must be enabled in our app’s dashboard, how you can create your very own loyalty launcher, and what your store’s customers will experience.

Configuring the loyalty widget settings
The Loyalty plugin’s settings can be accessed from our app’s Loyalty ➜ Settings ➜ Widget tab. 


You’ll want to ensure the following:

  • Enable the floating widget on all pages is toggled on

  • Show the launcher button setting is toggled off

N.B.: Both options are enabled by default when you install the Loyalty app block for the first time; leaving the Show the launcher button setting on won't affect creating a custom launcher.

Ensure to hit the Save button after you configure the settings.

Creating the loyalty custom launcher

We’ve developed two ways through which you can create the custom launcher:

  1. Using an HTML anchor element

  2. Invoking a JavaScript function

N.B.: An HTML anchor element is essentially a link, and this option is easier to implement than the JavaScript method.
1. Using an HTML anchor element

This method allows you to create a link that points to #froonze_loyalty_modal. So, when a customer accesses the link, our Loyalty Modal will open.


Below are two examples of how you can use this method:

  • Adding a link that opens the loyalty modal to the store navigation

  • Nesting an existing element inside a link that opens the loyalty modal

Linking in the store navigation

For this example, we’ll create a loyalty menu link to the store’s navigation menu. Please follow these steps to achieve that:


1. Navigate to the Content ➜ Menus section inside the Shopify admin dashboard, and access the Main menu option.
2. Press the Add menu item, add #froonze_loyalty_modal under the Link input field and select it from the dropdown, hit the Checkmark icon, and press the Save button.

You can view the result on your storefront. Clicking the loyalty menu item will open the loyalty modal, which contains your loyalty program.

Nesting an existing element

Let’s presume you want to add the modal launcher to an existing text element that’s on a Shopify page. You can follow these steps:


1. Navigate to the Online Store ➜ Pages section inside the Shopify admin dashboard, and access an existing page, or create a new one.


2. Hit the Show HTML icon and find the target text that you want to act as the loyalty launcher.

3. Wrap the text in an anchor tag, add #froonze_loyalty_modal as a value to the href attribute and make sure to hit the Save button. It should look like this:

To view the results, simply navigate to newly modified page and hit the link. It should open the loyalty modal.

2. Invoking a JavaScript function

This method allows you to control the opening and closing of the loyalty modal by invoking the frcp.loyalty.toggleLoyaltyWidget() function. It’s handy if you want to integrate with your own scripts or other apps.


It requires having some coding experience. However, below you can see it in action.

Loyalty icon in store navigation

In this example, we’re going to programmatically create, append and style a gift icon that will act as a custom loyalty launcher.


1. Access your theme’s Code Editor and find the theme’s Main Liquid file (e.g. theme.liquid, main.liquid, base.liquid, etc.)


2. Add the following 2 snippets before the ending </body> tag:

N.B.: The script and styling will need to be adjusted depending on the theme that's used; these snippets simply demonstrate how the frcp.loyalty.toggleWidget() function works.
3. Hit the Save button at the top and go to your live store.


4. Hit F5 or the Reload icon once or twice.


5. The newly added loyalty icon should now be visible, and when clicked, it should open the loyalty modal.

In this guide, we’ve seen that regardless of the method you prefer, creating your very own loyalty launcher is entirely possible. This will not only ensure that you stay on brand, design-wise, but that your customers will be able to access your loyalty program from where it’s most convenient!

Was this article helpful?

0 out of 0 liked this article