Run jQuery after WooCommerce AJAX cart update

后端 未结 3 1820
青春惊慌失措
青春惊慌失措 2020-12-14 10:15

WooCommerce:

I have some jQuery that loads on document.ready that effects the quantity input box. Works great.

My issue is that when I update the cart/del

3条回答
  •  臣服心动
    2020-12-14 10:43

    The WooCommerce scripts have several custom events built in. Your own script can listen to these events and run your own code when they are triggered. The most obvious one for your case might be updated_cart_totals but updated_wc_div might also be helpful, I'm not sure without testing. Tested and works.

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

提交回复
热议问题