Lookfy JavaScript API Documentation

Lookfy JavaScript API: Comprehensive Guide for Integration and Customization

What is the Lookfy JavaScript API?

JavaScript API documentation explains how to use various JavaScript events and methods in Shopify shops, which have the Lookfy app installed.

When the Lookfy app gets loaded

When the Lookfy app gets loaded, Lookfy automatically triggers the lookfyLoaded event.
Here is how you can configure a listener for said event:

// This event will be fired whenever the Lookfy app is loaded
document.addEventListener('lookfyLoaded', function(event) {
    // Do your magic :) 
});

This event will be fired whenever a gallery is rendered

When the Lookfy app gets created, Lookfy automatically triggers the lookfyGallery event.
Here is how you can configure a listener for said event:

// This event will be fired whenever the Lookfy app is created
document.addEventListener('lookfyGallery', function(event) {
    // Do your magic :) 
    const {galleryData, galleryElement} = event.detail;
});

When product is added to the cart from the Lookfy

When After the product gets added to the cart, our Lookfy app automatically triggers the following lookfyCartAdded event.
Here is how this event is triggered:

// This is how the event is triggered
document.dispatchEvent(new CustomEvent("lookfyCartAdded", { 
	detail: {
		cartDetail: response, 
		form: form, 
		cart: cart, 
		formID: formID
	}
}));

And here is how you can configure a listener for said event:

// This is how you can configure a listener for said event
document.addEventListener('lookfyCartAdded', function(event) {
    // Do your magic :) 
});
Did this answer your question?
😞
😐
😁