It looks like during the Checkout Review process, WooCommerce calls $.ajax()
to update the Order Review:
woocommerce/assets/js/frontend/checkout.js LN 377
The WooCommerce $.ajax()
does not trigger the ajaxComplete()
event since it’s not global. See jQuery AJAX Events
It looks like this plugin uses ajaxComplete()
to reinitialize the reCaptcha.
wp-recaptcha-integration/inc/class-wp_recaptcha_nocaptcha.php LN 207
One possible solution could be to add the following after the ajaxComplete()
check:
jQuery( document.body ).on( 'updated_checkout', function() {
wp_recaptchaLoadCallback();
} );
I’m having the same problem. Did you put this inside the nested if statements on ln 207 or after on ln 211?
@arpavlik You could use something along the lines of:
add_action( 'wp_print_footer_scripts', function() {
if( ! function_exists( 'is_checkout' ) || ! is_checkout() ) {
return;
}
?>
<script>
if( jQuery.isFunction( wp_recaptchaLoadCallback ) ) {
jQuery( document.body ).on( 'updated_checkout', function() {
wp_recaptchaLoadCallback();
} );
}
</script>
<?php
} );
I’m still seeing the same issue with the current version of WooCommerce.
I don’t like to edit other people’s plugins when used on production environments, but what I found to work in a staging environment was not what @howdy_mcgee exactly said. That is, there is nothing around line 207 that makes sense to add this in near, as that file has a class near there. What worked for me was to just append the code block above at the end of the file.
@alexclst to be clear, the code block I posted above is a stand-alone action hook you would need to add to a stand-alone plugin or a child-themes functions.php. The JS uses WooCommerce’s updated_checkout
event to call this plugins own JS function.
@howdy_mcgee thanks for the clarification.
J
(@sbwdblog8)
I’m experiencing the same thing on all my WooCommerce sites that use this plugin – will this be permanently fixed with a future plugin update?
@sbwdblog8 It’s been almost two months since this issue was reported, with no feedback from the dev(s). I would assume this plugin is abandoned, and if you can find a different plugin to do what you’re looking to do, that may be best.