The below code works fine with jquery, however, when I try to convert the same to javascript using addEventListener, I don’t get the same output. Here is the jQuery code snippet:
(function($){
$( document.body ).on( 'added_to_cart', function(){
console.log('EVENT: added_to_cart');
});
})(jQuery);
2
Answers
Even shorter in JS:
This will work. just create empty
html
file with script section and put this code there.