I need to wait for the checkout to be updated when the billing country is changed before I can run some AJAX calls on Woocommerce.
jQuery('select#billing_country').change(function(){
$( document.body ).on( 'updated_checkout', function( e, data ) {
//AJAX calls here
});
});
The problem is some of these calls then update the checkout as well and this results in an infinite loop. Is there a way to just wait for the checkout to be updated once (only the first time) every time the billing country is changed? So something like this:
jQuery('select#billing_country').change(function(){
$when.firsttime( 'updated_checkout', function( e, data ) {
//AJAX calls here
});
});
Thank you!