Archived topic
Hook for Running jQuery Function on Woocommerce Add To Cart AJAX Call
3 replies · Started by Zach on February 6, 2019
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
Hi there,
This sounds like a question for WooCommerce' support.
GP's Woo add-on simply provides style for WooCommerce module and does not interfere with the core functions of WooCommerce such as Add to Cart.
Makes sense thanks!
Your support is just light years better than theirs so figured I'd start here
No problem!
Looks like the code is something to do Elementor too so maybe their support is able to help as well :)