Run jQuery after updating AJAX WooCommerce trash

WooCommerce:

I have jQuery that loads on document.ready, which affects the quantity input field. It works great.

My problem is that when I update the cart / delete element, jQuery needs to be run again because an AJAX call kills it (updates it). Is there any hook / filter that I can add that will run my script again after updating the basket? I searched and can’t find anything (or maybe I don’t know what I'm looking for).

Thank!!!!

+8
source share
2 answers

WooCommerce . script , . updated_cart_totals, updated_wc_div , . .

$( document.body ).on( 'updated_cart_totals', function(){
    //re-do your jquery
});
+27

, , updated_cart_totals updated_wc_div .

Woocommerce

[/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js]

:

$(document.body).on('added_to_cart removed_from_cart', do_magic);

!

+1

Source: https://habr.com/ru/post/1653556/


All Articles