Free product rewards
On Shopify stores, shoppers can redeem free product rewards. After redemption, the target product is added to the cart and automatically discounted using a Shopify Function.
A few things are needed to facilitate this flow through the LoyaltyLion WebView.
Listen for the sdkReady event and set the cart state
Listen for the sdkReady event, which is fired when LoyaltyLion has finished loading in the WebView.
Once you receive this event, you should pass the current Shopify cart state to the LoyaltyLion SDK, using the setShopifyCartState method
Subscribe to the addCartLine event
When a free product reward has been successfully redeemed by the shopper, we’ll fire the addCartLine event with details of the item you need to add to the cart.
Subscribe to the removeCartLine event
Occasionally we’ll need to remove a previously added item from the cart, for example if the shopper has cancelled the reward.
We’ll fire the removeCartLine event when this happens, passing along the id
of
the cart line to remove from the cart.