I need to use the new Google “no Captcha” reCaptcha in frontend Woocommerce registration form page.
I’ve inserted following code before the < / head > tag:
<script src='https://www.google.com/recaptcha/api.js'></script>
and this one inside form tab in file “woocommercemyaccountform-login.php”:
<div class="g-recaptcha" data-sitekey="xxxxxxxxx MY ID xxxxxxxxx"></div>
where, obviously, “xxxxxxxxx MY ID xxxxxxxxx” is my google id code.
It shows the new captcha box but if I try to register a new user without check the captcha, it doesn’t stops registration process and complete registration without errors.
It’s being a while since Stimart opened this question but I’ll give here my suggestion in case someone needed it.
Stimart here need to add some PHP code to validate the reCaptcha response value that google sends to the page when the user ticks the reCaptcha box to confirm they are not a robot.
The hard way would be to write something like this in the functions.php file:
You can check this article http://www.themelocation.com/how-to-add-custom-fields-to-user-registration-form-in-woocommerce/ and the way this plugin https://wordpress.org/plugins/theme-my-login/ handle this problem.
or a lot easier is to install and set up a plugin like this one. 😉
Hope that it helps. 🙂
For Woocommerce Registration form, I think one can add Google Recaptcha using this simple code rather a plugin. Just need to grab ‘site-key’ from Google account http://www.google.com/recaptcha/admin#whyrecaptcha
1. Define JS in the theme’s header.php file
2. Add this code in the theme’s functions.php file (Don’t forget to replace ‘##your-google-captcha-key##’ with your google captcha site-key)