Hi @japenz
Hope this message finds you well.
Some caching plugins have a Delay JavaScript feature which might cause issues with reCaptcha. Are you using WP Rocket to delay assets?
Still, after testing on my site I was not able to reproduce the issue, is such a case, could you perform a conflict test? Kindly follow this guide for it https://wpmudev.com/docs/getting-started/getting-support/#conflict-test
Please let us know the results.
Best regards,
Laura
Ash
(@ashbryant)
Following this as I too am having this issue
Hi @ashbryant
Hope this message finds you well.
Even though that looks similar we need to investigate case by case.
Can you create a new thread: https://ww.wp.xz.cn/support/plugin/defender-security/#new-topic-0 so we don’t spam the original thread starter? Thank you.
Best Regards
Laura
Ash
(@ashbryant)
@wpmudevsupport3
I’m not spamming, I’m just following. Should the help you give here doesn’t work, I will (and would have anyway) started a new thread.
Hi @japenz
We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!
Kind Regards,
Kris
Thread Starter
JapeNZ
(@japenz)
Hi @wpmudevsupport13,
I wasn’t able to resolve the issue, but think it might be a limitation of V3 rather than the Defender plugin.
I think the customers that had the problem may have added products from the homepage and gone straight to the checkout. As they hadn’t clicked on the website many times, they weren’t passing the recaptcha V3 test.
I’ve switched to V2 checkbox and everything seems fine now.
Thanks for your help.
Thread Starter
JapeNZ
(@japenz)
Hello again,
So it looks like your reCaptcha V2 option has a conflict with PayPal.
I’ve just had a customer attempt to complete an order and get kicked back to our website to find a reCaptcha error notice.
The order wasn’t registered on our end, but the payment was attempted twice by PayPal before being reversed.
We’re disabling recaptcha in Defender as neither version seems to work correctly and the 3rd party plugin we were using didn’t have any issues.
Hello @japenz,
I hope you’re doing great today!
If you’re using WooCommerce PayPal Payments plugin, the issue might be happening due to captcha being sent twice during checkout.
In this case, could you please test it again, after adding the following PHP snippet as a workaround:
<?php
add_action( 'plugins_loaded', function() {
if ( ! class_exists( 'WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway' ) ) {
return; // "WooCommerce PayPal Payments" is not installed/enabled.
}
if ( ! defined( 'DEFENDER_VERSION' ) ) {
return; // Defender is not installed/enabled.
}
add_filter( 'wd_recaptcha_check_result', function( $result, $form ) {
if ( empty( $_REQUEST[ 'g-recaptcha-response' ] ) && empty( $_POST[ 'g-recaptcha-response' ] ) ) {
return $result;
}
$transient_key = ! empty( $_REQUEST[ 'g-recaptcha-response' ] ) ? $_REQUEST[ 'g-recaptcha-response' ] : $_POST[ 'g-recaptcha-response' ];
$transient_key = '_wdwc-g-recaptcha-' . md5( $transient_key );
$transient_value = get_transient( $transient_key );
if ( empty( $_REQUEST[ 'wc-ajax' ] ) || 'ppc-create-order' !== $_REQUEST[ 'wc-ajax' ] ) {
if ( $result ) {
set_transient( $transient_key, true, 60 ); // Save the reCaptcha response for 60 seconds.
} else if ( '1' === $transient_value ) {
$result = true;
}
return $result;
}
if ( $result && false === $transient_value) {
set_transient( $transient_key, true, 60 ); // Save the reCaptcha response for 60 seconds.
}
return $result;
}, 10, 2 );
});
– save the code in a text editor as a PHP file, for example: defender-recaptcha-paypal-payments.php, and upload it to /wp-content/mu-plugins/ directory on the server, to make it run as a must use plugin.
I hope this helps. Please let us know if there’s still any issue.
Best Regards,
Dmytro
Thread Starter
JapeNZ
(@japenz)
Hi @wpmudevsupport16,
Thank you for the suggestion.
We’re testing the Simple Cloudflare Turnstile plugin as an alternative as Google reCaptcha has caused too many issues with customers trying to place orders.
I’ll certainly keep your suggestion in mind if we end up having to revert back to reCaptcha.