Installation on Headless Shopify

LoyaltyLion has support for headless Shopify stores. You still install LoyaltyLion via Shopify as normal, however you will need to handle the frontend implementation of the SDK yourself. ​

In order for LoyaltyLion UI to show on the page, you need to :

  • add the SDK snippet
  • initialize the SDK
  • handle customer authentication after initializing the SDK

How to add the SDK to your theme

First, add the SDK snippet - Installation

How to initialize the SDK

Call loyaltylion.init to initialize the SDK - ​Initialization

You need to make sure to call init straight away when you load the snippet using the correct site token like so:

loyaltylion.init({
token: 'YOUR_SITE_TOKEN',
})

The SDK should be loaded on every page on your store, otherwise your customers might not be able to view the loyalty program

How to handle customer authentication

Follow the steps below to ensure your logged in customers can see their points and other LoyaltyLion features on your headless storefront. ​

If you choose to pass the customer and auth data to the loyaltylion.init call, you need to use a conditional statement to check if the customer is logged in or not. Either call init with just the token or pass the customer’s data. ​

Initialize-example-with-customer

If you want to authenticate the customer later, you still need to call init immediately when you load the snippet. Make sure to use only the site token (without the customer data), and later call loyaltylion.authenticateCustomer method as described here:

Authentication-after-initialization


Which rewards are supported on a headless store?


Supported rewards:


Unsupported rewards:

On a headless storefront features that interact with the frontend Shopify API are not expected to work. These include the following rewards:


Which features are supported on a headless store?


Supported features: