Home Tech & Gadgets How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

by Munmun Akhter
0 comment
5/5 - (2 votes)

After building a WooCommerce store with ShopReady, we faced the biggest challenge of protecting the site from spammers. Yeah, spammers could use different automated technologies to infiltrate your business and attempt to make fraudulent orders. Now going to learn How to Add Captcha to WooCommerce Checkout ?

That can bring potential damage to your business by causing misleading transactions. So you need to make sure the user is a real human, and you also have to stop automated scripts and bots from interfering with your checkout page.

To solve this, you’ve to add a captcha at checkout on your WooCommerce store. This article will discuss why and how you can add a captcha to protect your business from spamming tools and bots.

You can do it by using a plugin or without a plugin. We’ll cover all the possible methods we implemented on our WooCommerce store built with ShopReady so that you can use them add Captcha to your site. Let’s start!

How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

Why Add Captcha To Woocommerce Checkout?

You may have built your WooCommerce store with a tool like ShopReady but struggling to ensure its safety. Adding a captcha at the checkout could be one of those security measures you should look into.

The primary reason to add a captcha to the WooCommerce checkout is to protect the site from automated malicious attacks that try to make fraudulent purchases. It prevents automated tools from completing the sales forms while preventing fake registrations and guest orders. Captcha can stop misleading transactions that could save your from any potential loss.

Some think captcha could make user interaction a bit complicated, but there are ways you can implement a low-friction user experience that is generally convenient for customers. And the only thing that’ll find captcha hard to crack is those “computerized bots.”

How To Add Captcha To Woocommerce Checkout?

Now moving to how we’ve added a captcha to our ShopReady WooCommerce store’s checkout page. We’ve tried both the plugins and without-plugin methods.

While trying these, we came up with some great plugins and code snippets. Let’s discuss all these methods and see which one’s right for you.

How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

  1. With Plugin

To let your customer proceed with the purchase from your WooCommerce store, you can use different captcha verification plugins on the checkout page or anywhere you want on the site.

There are quite a few such plugins available out there. However, the top 3 that we tried while building our WC store with ShopReady include the followings:

  • reCaptcha for WooCommerce

This is a premium plugin designed specifically for WooCommerce Spam Protection. It’s not available as a free version, so you’ll have to pay for it first. Using this plugin, you can add Google ReCAPTCHA to the checkout page and other forms, including register, log in, password lost form, etc.

It can display multiple captchas on one page like if you’ve got the login and registration form on the same page, you can enable captchas in both forms.

You can have both reCaptcha v2 and ReCaptcha V3 using this plugin. Some of its other key features include automatic user language detection, reCaptcha customization, error message customization, and so on.

It’s essy to install simply like any other WordPress plugin from the Plugins page. The easy settings come with on/off options to enable or disable the captcha on required places. We didn’t have any problem enabling it with thr ShopReady tool.

The plugin is built on high standards to stop fake registrations and orders and to make sure nothing can break the site anyway.

How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

  • CAPTCHA 4WP

Supported and Maintained by WP White Security, this is one of the best captcha plugins that allow real humans to pass through the WooCommerce forms and checkout pages.

It protects your store from bots, not letting them interfere with your orders. Besides checkout pages, you can use this plugin to display the captcha in different segments such as forms, comments, registration, password lost/reset, and so on.

The highlight of this plugin is you can use this to show multiple captchas on a single page. It also supports custom captcha styles. You can choose from v2 (I’m not a robot), v2 (invisible), or v3. It automatically detects the users’ language to show the captcha and settings accordingly.

You can add captchas in several forms by default, but for Contact Form 7, you’ve to add short code. It’s available in both free and premium versions. We’ve tried the premium version while using ShopReady.

You can easily install it from the Plugins page in your WooCommerce account. Search for the CAPTCHA 4WP, install and activate it to protect your store from spammers.

How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

  • reCaptcha by BestWebSoft

  • BestWebSoft brings another effective captcha solution to protect your WooCommerce store. It works with almost all forms, including WooCommerce checkout billing forms.

You can use the reCaptcha v2, v3, and invisible versions with this plugin. The customer must confirm that they are not a robot before proceeding with the shopping.

It prevents spam and brute force attacks by using Limit Attempts. The product is backed by quick and friendly support.

The installation is easy like any other WP plugin. You can download, install, and activate it from the Plugins page. Once set up, you can go to the settings and choose the checkout page or any other required place to enable it.

The plugin includes easy settings with a detailed guide for quick setup. It’s a multilingual plugin with RTL-ready features. You can also add custom code using the settings. It comes with multiple captcha themes as well. All in all, the plugin worked well with the ShopReady builder tool.

  1. Without Plugin

After seeing the plugin-way, it’s time to find out how you can add a captcha without a plugin to the WooCommerce checkout page.

How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

Since Google offers the reCaptcha v2 anti-spam service for free, you can implement that on your site without a plugin. We had a successful experience of implementing this while using ShopReady. It’s the most popular captcha API, and you’ve to do some coding to add it on your WC checkout without a plugin.

But before you use the code snippet, remember that you can’t place it in the payment section of the form. And you’ll have to choose an action accordingly to add it successfully.

<?php

/**

* Add reCaptcha to the checkout form

* @param $checkout

*/

function doublee_show_me_the_checkout_captcha($checkout) {

echo ‘<div class=”g-recaptcha” data-sitekey=”YOUR_KEY_HERE”></div>’;

}

add_action(‘woocommerce_checkout_order_review’, ‘doublee_show_me_the_checkout_captcha’, 18);

/**

* Validate reCaptcha

*/

function doublee_process_recaptcha() {

$postdata = $_POST[‘g-recaptcha-response’];

$verified_recaptcha = file_get_contents(‘https://www.google.com/recaptcha/api/siteverify?secret=YOUR_KEY_HERE&response=’.$postdata);

$response = json_decode($verified_recaptcha);

if(!$response->success) {

wc_add_notice(‘Please verify that you are not a robot’ ,’error’);

}

}

add_action(‘woocommerce_checkout_process’, ‘doublee_process_recaptcha’);

We tried and it worked well with our ShopReady WooCommerce store.

How To Enable Google Recaptcha V2 On Woocommerce Checkout?

How to Add Captcha to WooCommerce Checkout

How to Add Captcha to WooCommerce Checkout

Google ReCaptcha v2 is the most popular extension for captchas to set up in WooCommerce sites. So we think it’s worth guiding you on its complete user process.

To do this, the best way is to use reCaptcha for the WooCommerce plugin, as it supports both the V2 and V3 versions.

  • First, download the .zip file from the WC account.
  • Now go to the Admin > Plugins > Add New > Upload Plugin
  • Choose the file you downloaded
  • Install and activate reCaptcha
  • After activation, go to wooCommerce > Settings
  • Click the reCaptcha tab in the Settings
  • Choose the Recaptcha version as ReCaptcha V2 (checkbox)
  • Set the Site Key and Secret Key
  • Keep other fields like error messages as it is
  • Save the settings
  • From the list of tabs for enabling captchas, choose the WooCommerce guest checkout and tick the box to enable reCaptcha to guest checkout page.

To get the Site Key and Secret Key, follow the steps below:

  • Log into your Google account
  • Go to the Google ReCaptcha Admin Console (https://www.google.com/recaptcha/admin)
  • Click the + button at the top right
  • Add your website name in the Add Label.
  • Choose reCaptcha v2.
  • Select the “I am not a robot” Checkbox.
  • Add the website domain
  • Accept term of service
  • Once finished, click Submit
  • The site key and secret key should appear; simply copy and use them.
  • How to Add Captcha to WooCommerce Checkout

    How to Add Captcha to WooCommerce Checkout

Conclusion

This wraps it up for the guide on adding captcha to WooCommerce checkout. We must say all these captcha methods worked awesome on our ShopReady WooCommerce checkout. So this article should work well for you as well!

It discusses some excellent plugins that can effectively protect your WC store from spammers. The reCaptcha for WooCommerce is the standout one here that allows you to set up Google reCaptcha V2 or V3 easily and effectively.

We’ve also discussed how you can add the reCaptcha V2 API by adding some codes in the respective place. Whichever way you choose from the above method, you can expect to keep your site safe from fraudulent orders after enabling any of them.

WordPress Security best Practice

How to Have a Dual Currency in WooCommerce

How Does Alcohol Affect Weight Loss? Find Out the Surprising Truth!

You may also like

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.