Hello,
I am trying to add a class to a div with jQuery when a product is added to the cart in order to display a side menu cart instead of the default Woocommerce pop up message.
I am running this js in a wp_footer hook element:
(function($){
$( document.body ).on( 'added_to_cart', function(){
$( ".elementor-menu-cart__container:first" ).addClass( "elementor-menu-cart--shown" );
});
}(jQuery);
But it is not working. Should I be hooking into a different action? Could the add to cart AJAX call be interrupting my script? Am I approaching this completely the wrong way? haha