0

Is there any way to prevent the update_checkout() function from firing on the checkout page while a user is typing in the boxes? It seems to be set on some sort of set_timeout() where it's firing a couple of seconds after the latest change event, but sometimes it removes focus from the current box and so shipping calculations may appear broken if a string is incomplete or malformed.

I don't know if it's relevant, but we're in the process of adding a custom field to the Billing & Shipping info forms so we can allow users to set pickup and dropoff addresses. We're modifying a plugin called Distance Rate Shipping by Automattic.

Anyway, I thought I'd ask because this is the first time I've worked with Woocommerce and I'm not sure where that change event originates from. I'd like to set it to blur rather than change at the very least.

1 Answer 1

2

It's been a while and maybe you don't need this information. But i am having exactly the same problem. So i have come up with this solution:

window.setTimeout(
 function () {
  $('form.checkout').off('input keydown change', '.address-field input.input-text, .update_totals_on_change input.input-text');
}, 0);

It removes all "input/keydown/change" events from zipcode and address fields. I have used setTimeout to call my function asynchronously after all the woocommerce scripts. But to apply my own functionality i need to use some kind of callback inside this function;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.