Skip to main content
All CollectionsDeveloper
How To Listen For Rebuy JS Callbacks To Provide Custom UX
How To Listen For Rebuy JS Callbacks To Provide Custom UX

In this guide we'll show you how to use Rebuy JS callbacks to provide custom UX for your users.

Strauss Van Wagenen avatar
Written by Strauss Van Wagenen
Updated over a week ago

The following Rebuy JS callbacks are available:

For even more, please visit the Rebuy Developer Hub at

// = = = = = WIDGET = = = = = // document.addEventListener('rebuy.init', function(event){ console.log('rebuy.init event', event.detail); }); 

document.addEventListener('rebuy.beforeReady', function(event){ console.log('rebuy.beforeReady event', event.detail); });

document.addEventListener('rebuy.ready', function(event){ console.log('rebuy.ready event', event.detail); });

document.addEventListener('rebuy.beforeAdd', function(event){ console.log('rebuy.beforeAdd event', event.detail); });

document.addEventListener('rebuy.add', function(event){ console.log('rebuy.add event', event.detail); });

document.addEventListener('rebuy.beforeRemove', function(event){ console.log('rebuy.beforeRemove event', event.detail); });

document.addEventListener('rebuy.remove', function(event){ console.log('rebuy.remove event', event.detail); });

document.addEventListener('rebuy.beforeChange', function(event){ console.log('rebuy.beforeChange event', event.detail); });

document.addEventListener('rebuy.change', function(event){ console.log('rebuy.change event', event.detail); });

document.addEventListener('rebuy.beforeDecline', function(event){ console.log('rebuy.beforeDecline event', event.detail); });

document.addEventListener('rebuy.decline', function(event){ console.log('rebuy.decline event', event.detail); });

document.addEventListener('rebuy.view', function(event){ console.log('rebuy.view event', event.detail); });

document.addEventListener('rebuy.beforeProductsChange', function(event){ console.log('rebuy.productsChange event', event.detail); });

document.addEventListener('rebuy.productsChange', function(event){ console.log('rebuy.productsChange event', event.detail); });

document.addEventListener('rebuy.refresh', function(event){ console.log('rebuy.refresh event', event.detail); });

document.addEventListener('rebuy.beforeShow', function(event){ console.log('rebuy.beforeShow event', event.detail); });

document.addEventListener('rebuy.show', function(event){ console.log('rebuy.show event', event.detail); });

document.addEventListener('rebuy.beforeHide', function(event){ console.log('rebuy.beforeHide event', event.detail); });

document.addEventListener('rebuy.hide', function(event){ console.log('rebuy.hide event', event.detail); });

// = = = = = CART = = = = = // document.addEventListener('rebuy:cart.init', function(event){ console.log('rebuy:cart.init event', event.detail); });

document.addEventListener('rebuy:cart.ready', function(event){ console.log('rebuy:cart.ready event', event.detail); });

document.addEventListener('rebuy:cart.add', function(event){ console.log('rebuy:cart.add event', event.detail); });

document.addEventListener('rebuy:cart.change', function(event){ console.log('rebuy:cart.change event', event.detail); });

document.addEventListener('rebuy:cart.enriched', function(event){ console.log('rebuy:cart.enriched event', event.detail); });

// = = = = = SMART CART = = = = = // document.addEventListener('rebuy:smartcart.init', function(event){ console.log('rebuy:smartcart.init event', event.detail); });

document.addEventListener('rebuy:smartcart.ready', function(event){ console.log('rebuy:smartcart.ready event', event.detail); });

document.addEventListener('rebuy:smartcart.show', function(event){ console.log('rebuy:smartcart.show event', event.detail); });

document.addEventListener('rebuy:smartcart.hide', function(event){ console.log('rebuy:smartcart.hide event', event.detail); });

// = = = = = NOTIFICATION = = = = = // document.addEventListener('rebuy:notification.ready', function(event){ console.log('rebuy:notification.ready event', event.detail); });

document.addEventListener('rebuy:notification.show', function(event){ console.log('rebuy:notification.show event', event.detail); });

document.addEventListener('rebuy:notification.hide', function(event){ console.log('rebuy:notification.hide event', event.detail); });

// = = = = = REBUY JAVASCRIPT = = = = = // document.addEventListener('rebuy.beforeLoaded', function(){ console.log('rebuy.beforeLoaded event'); });

document.addEventListener('rebuy.loaded', function(){ console.log('rebuy.loaded event'); });
Did this answer your question?