[Resolved] Hook for Running jQuery Function on Woocommerce Add To Cart AJAX Call

Home Forums Support [Resolved] Hook for Running jQuery Function on Woocommerce Add To Cart AJAX Call

Home Forums Support Hook for Running jQuery Function on Woocommerce Add To Cart AJAX Call

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #803233
    Zach

    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

    #803236
    Leo
    Staff
    Customer Support

    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.

    #803270
    Zach

    Makes sense thanks!

    Your support is just light years better than theirs so figured I’d start here

    #803304
    Leo
    Staff
    Customer Support

    No problem!

    Looks like the code is something to do Elementor too so maybe their support is able to help as well 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.