Support » Plugin: WooCommerce Payments » Bug in checkout.js

  • Resolved prateekdarmwal


    On dist/checkout.js the code snippet

    e(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.


Viewing 1 replies (of 1 total)
  • Plugin Support Mike Straw


    Hi @prateekdarmwal ,

    Thanks for pointing this out!

    I’ve reported this to our developers to fix in a future release. You can see the reported issue here.

    I can’t give a timeline for when they might get this corrected, but once the developers apply the fix, they’ll close the issue and it should be in the next release of WooCommerce Payments. You can also check the WooCommerce Payments changelog to see when it’s resolved.

    Since this particular bug will be tracked on the plugin’s GitHub repository, I’m going to mark this thread as solved.

    If you have any questions about the particular bug, please add them to the GitHub issue. If you any other questions, you can start another thread.


Viewing 1 replies (of 1 total)
  • The topic ‘Bug in checkout.js’ is closed to new replies.