• Updating to WooCommerce 7.5.0 appears to break the implementation of the Checkout Recaptcha. You can see the ReCaptcha for a minute while WooCommerce loads the order_review section, but once the load finishes, the ReCaptcha disappears. Upon checkout, the following error appears:

    Error: the Captcha didn’t verify.

    I’m running:
    WordPress 6.1.1
    WooCommerce 7.5.0
    WP reCaptcha Integration 1.2.5
    Storefront Theme 4.2.0
    PHP 8.0.14

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Howdy_McGee

    (@howdy_mcgee)

    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?

    Thread Starter Howdy_McGee

    (@howdy_mcgee)

    @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.

    Thread Starter Howdy_McGee

    (@howdy_mcgee)

    @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?

    Thread Starter Howdy_McGee

    (@howdy_mcgee)

    @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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Checkout Issues on WooCommerce 7.5.0’ is closed to new replies.