ULTIMATE Cart Drawer is designed as developer friendly and it dispatches events for every step so that you can customise some of the functionalities to advanced level. 


How to listen for an event?


window.addEventListener('Sellify::UCD::EVENT_NAME_HERE', function(e){
    // do your thing
});


Events:


  1. Initialized: This is very first event that is fired when app is ready to setup it's js/css/html.
  2.  NoteUpdated: When cart note is updated
  3. ItemAdded: When a new item is added to cart
  4. ItemChanged: When quantity of an item in cart is changed
  5. CartHidden: When cart drawer is hidden
  6. CartVisible: When cart drawer is visible
  7. CartBuilt: When cart drawer is built with the items in cart and other elements.
  8. CartLoaded: When cart drawer is opened with updated cart.
  9. UpsellsRendered: When upsell items are rendered and ready


Example:


window.addEventListener('Sellify::UCD::ItemAdded', function(e){
    alert(`${e.detail.line_item.title} is now added to your cart.`)
});


We also have an event which is dispatched for all events:


window.addEventListener('Sellify::UCD::*', function(e){
    console.log(`${e.detail.event} is fired.`)
});


Is there an event dispatched when my currency app need to convert prices?


window.addEventListener('ConvertPrices', function(e){
    // Call your currency converter app's functions here
});


If you want a currency conversion app which has automatic integration with ULTIMATE Cart Drawer, Check our very own currency conversion app: https://apps.shopify.com/ultimate-currency-converter


 

P.S. Every event provides different types of parameters. To check what params are passed, try to console log e.detail for each event.