Bug in checkout.js
-
Hi,
On dist/checkout.js the code snippete(document.body).on("updated_checkout",function(){e("#wcpay-card-element").children().length || (u.unmount(), u.mount("#wcpay-card-element"))})throws an error if the user applies a coupon on checkout and the cart total value updates to 0 (zero).
since there is no payment needed the woo ajax removes the payment section. But the above code still searches for the #wcpay-card-element element’s children which results in payment integration failure throws a js console error and prevents further js execution.I think it would be better to add a condition to check for the #wcpay-card-element element’s length first and then do mount/unmount procedures.
I patched on my website to overcome this error.
Changed above snippet to –
e(document.body).on("updated_checkout",function(){if(e("#wcpay-card-element").length){e("#wcpay-card-element").children().length || (u.unmount(), u.mount("#wcpay-card-element"))}})Please fix this bug on the new release.
Thanks
The topic ‘Bug in checkout.js’ is closed to new replies.