discolabs / cartjs

A Javascript library to power cart management for Shopify themes.
https://cartjs.org
MIT License
477 stars 85 forks source link

cart.requestComplete Vanilla js? #204

Open Sanj718 opened 3 years ago

Sanj718 commented 3 years ago

Hello! I want to know if you help to understand how events are working on vanilla js?

$(document).on('cart.requestComplete', function(event, cart) {
        $('#counter').html(cart.item_count);
 });

This way is not working:

document.addEventListener('cart.requestComplete', function(event, cart) {
  // Event handling here.
  console.log(cart)
})

Thank you

bstarr322 commented 2 years ago

Yeah, this isn't working for me either.

gautam-grazitti commented 2 years ago

Hello, yes, I'm also getting the same issue. Is there any fix for this?