Skip to main content
All CollectionsLoyalty & Rewards
Appstle Loyalty JavaScript API Documentation
Appstle Loyalty JavaScript API Documentation
Updated over 3 months ago

The Appstle Loyalty JavaScript API documentation explains how to use various JavaScript events and methods in the Appstle Loyalty app. For example, when your customer apply discount code in your shop, this API allows you to capture these events and take actions accordingly. You can also use this API to customize the customer experience in your shop.

When a Loyalty Rewards Discount Code is Applied

When a Loyalty reward discount code is applied to the Cart through loyalty widget or dedicated page, a custom JavaScript event AppstleLoyalty:AppliedDiscountCode

will be triggered on the document. You can use this event to execute custom JavaScript code when a Loyalty reward discount code is applied to the cart.

Here is how you can configure a listener for this event:

// This event will be fired when a Loyalty reward discount code is applied to the cart.

document.addEventListener('AppstleLoyalty:AppliedDiscountCode', function(event) {
console.log("Discount Event: ",event?.detail);
// Do your custom actions here
});
Did this answer your question?