I have some additional javascript I’m looking to run on the WooCommerce checkout page when a user changes their shipping method. Currently, I’m using the following;
jQuery( document.body ).on( 'updated_checkout', function() {
// Javascript here...
});
The problem with the above is that this event fires when users also change any of the checkout data including the address. I only want to run my javascript when the shipping method is updated at checkout. I can’t see any event listeners or hooks for this.
2
Answers
Thanks, @CBroe in the comments for pointing me in the right direction, I was looking to overcomplicate the problem. See my solution below;
This works with the default WooCommerce shipping classes;
You can add this action: