Event Listeners
Init¶
Triggers on Bundle Builder Widget initialization and passes the Bundle Builder Widget instance into the event details.
document.addEventListener('rebuy.init', function(event){
console.log('rebuy.init event', event.detail);
});
Before Ready¶
Triggers before the Bundle Builder Widget is ready and passes the Bundle Builder Widget instance into the event details.
document.addEventListener('rebuy.beforeReady', function(event){
console.log('rebuy.beforeReady event', event.detail);
});
Ready¶
Triggers when the Bundle Builder Widget is ready and passes the Bundle Builder Widget instance into the event details.
document.addEventListener('rebuy.ready', function(event){
console.log('rebuy.ready event', event.detail);
});
Add Product To Bundle¶
Triggers once a product is added from the Bundle Builder Widget to the bundle container. This event passes the product along with the Bundle Builder Widget instance into the event details.
document.addEventListener('rebuy.addProductToBundle', function(event){
console.log('rebuy.addProductToBundle event', event.detail);
});
Remove Product From Bundle¶
Triggers once a product is removed from the bundle container. This event passes the product to be removed along with the Bundle Builder Widget instance into the event details.
document.addEventListener('rebuy.removeProductFromBundle', function(event){
console.log('rebuy.removeProductFromBundle event', event.detail);
});
Add Bundle To Cart¶
Triggers once all about-to-be-added products from the bundle container to the Shopify Cart. This event passes all products along with the Bundle Builder Widget instance into the event details.
--- title: Event Listeners excerpt: Handle Bundle Builder widget events for product and cart actions deprecated: false hidden: false metadata: title: '' description: '' robots: index next: description: '' --- ## Init Triggers on Bundle Builder Widget initialization and passes the Bundle Builder Widget instance into the event details. ```javascript document.addEventListener('rebuy.init', function(event){ console.log('rebuy.init event', event.detail); }); ``` ## Before Ready Triggers before the Bundle Builder Widget is ready and passes the Bundle Builder Widget instance into the event details. ```javascript document.addEventListener('rebuy.beforeReady', function(event){ console.log('rebuy.beforeReady event', event.detail); }); ``` ## Ready Triggers when the Bundle Builder Widget is ready and passes the Bundle Builder Widget instance into the event details. ```javascript document.addEventListener('rebuy.ready', function(event){ console.log('rebuy.ready event', event.detail); }); ``` ## Add Product To Bundle Triggers once a product is added from the Bundle Builder Widget to the bundle container. This event passes the product along with the Bundle Builder Widget instance into the event details. ```javascript document.addEventListener('rebuy.addProductToBundle', function(event){ console.log('rebuy.addProductToBundle event', event.detail); }); ``` ## Remove Product From Bundle Triggers once a product is removed from the bundle container. This event passes the product to be removed along with the Bundle Builder Widget instance into the event details. ```javascript document.addEventListener('rebuy.removeProductFromBundle', function(event){ console.log('rebuy.removeProductFromBundle event', event.detail); }); ``` ## Add Bundle To Cart Triggers once all about-to-be-added products from the bundle container to the Shopify Cart. This event passes all products along with the Bundle Builder Widget instance into the event details. ```javascript document.addEventListener('rebuy.addBundleToCart', function(event){ console.log('rebuy.addBundleToCart event', event.detail); }); ```