Shopify themes, liquid, logos, and UX
Hello, I would like to use google recaptcha on my custom form on a custom page.
How to do it?
This is how to do it (assuming you know how to get the key). Add this script to the bottom of the liquid page of where you want to put your code. Change the xxx-site-key code to your own.
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<div id="re-captcha"></div>
<script>
var actCallback = function (response) {
$('#contactFormSubmit').prop("disabled", false);
$('#re-captcha').remove();
};
var expCallback = function() {
$('#contactFormSubmit').prop("disabled", true);
};
var onloadCallback = function () {
var widget = grecaptcha.render(document.getElementById("re-captcha"), {
'sitekey' : "site-key-codexxx", // Sitekey, Retrieving from reCaptcha
'theme': "light",
'callback' : actCallback,
'expired-callback': expCallback,
});
}
</script>
the code is worked but when submit the form it's show 404 error how to solve the issue
@Feddrow1 Did you get the solution for 404 as I am also facing the same issue after implementing the code.
Have you figured it out yet?
You can use shopify forms.
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025