arrow_back_ios Blog How to Add hCaptcha to Magento 2 Forms

How to Add hCaptcha to Magento 2 Forms

calendar_today April 9, 2026 visibility 42 views folder_open Magento 2 Extensions, Magento 2 Security label WebForms, CAPTCHA, Form Security person By Vladimir Popov

Last updated: April 24, 2026 · Tested on Magento 2.4.7 with Grasch_HCaptcha 1.3.0 and MageMe WebForms.

hCaptcha for Magento 2 is a privacy-friendly CAPTCHA that blocks bots without sending visitor data to Google — GDPR-compliant by design and free for up to 1M verifications/month. You can enable it globally on native Magento forms (admin login, customer login, contact, reviews, newsletter, checkout) using the free open-source Grasch_HCaptcha module, or switch the CAPTCHA provider on custom forms built with MageMe WebForms. This guide covers both paths.

Which path is right for you?

Option A · Free Grasch_HCaptcha module

Protect Magento’s native forms globally in 5 minutes. MIT-licensed, no fee.

  • Admin login & forgot password
  • Customer login, register, forgot
  • Contact, product review, newsletter
  • Checkout, coupon, send-to-friend
Jump to install ↓

Option B · MageMe WebForms

hCaptcha on custom forms you build with WebForms — contact forms, surveys, multi-step wizards, file uploads.

  • Custom-built WebForms forms
  • Per-form on/off mode override
  • Light/Dark theme, Normal/Compact size
  • Hyva & Breeze compatible
Jump to setup ↓

Why Choose hCaptcha Over reCAPTCHA

Google reCAPTCHA is the most common CAPTCHA solution, but it sends visitor browsing data to Google for risk analysis. For stores operating under GDPR, CCPA, or other privacy regulations, this creates compliance concerns. hCaptcha solves this by keeping data processing minimal and transparent.

hCaptcha

  • No visitor tracking or profiling
  • GDPR & CCPA compliant by design
  • Free tier: 1M requests/month
  • Data processed in the US & EU
  • Works without cookies
  • Accessibility mode available

Google reCAPTCHA

  • Collects browsing data for risk scoring
  • Requires cookie consent under GDPR
  • Free, but data is used by Google
  • Data processed by Google globally
  • Uses tracking cookies
  • May require privacy policy updates

For EU-based stores or merchants selling to EU customers, hCaptcha eliminates the need for complex consent mechanisms that reCAPTCHA requires under GDPR regulations.

Option A — Free Grasch_HCaptcha Module

The open-source Grasch_HCaptcha module extends Magento’s built-in Magento_ReCaptcha framework and swaps the provider from reCAPTCHA to hCaptcha. This means hCaptcha automatically protects every form that Magento’s stock reCAPTCHA integration already covers — no code changes needed, no per-form configuration.

Grasch_HCaptcha

MIT · v1.3.0 · Magento 2.4.x · PHP 7.4+ · Composer: grasch/module-hcaptcha

A drop-in hCaptcha provider that plugs into Magento’s native reCAPTCHA extension points. Once installed and configured, it covers the following forms out of the box:

  • Admin panel login & forgot password
  • Customer login, register, forgot password
  • Contact form
  • Product review form
  • Newsletter subscription
  • Send-to-friend (wishlist)
  • Checkout (guest & logged-in)
  • Apply coupon code
  • PayPal PayflowPro
  • GraphQL & REST API validation
  • Visible and invisible modes
  • Per-form on/off toggles

View on GitHub →

Install via Composer

From your Magento 2 root directory:

composer require grasch/module-hcaptcha
bin/magento setup:upgrade
bin/magento setup:static-content:deploy
bin/magento cache:clean

If you run a production build, add bin/magento setup:di:compile between setup:upgrade and setup:static-content:deploy.

Configure in Admin

  1. Sign up at hcaptcha.com, add your domain, and copy the Site Key and Secret Key.
  2. In Magento Admin, open Stores → Configuration → Security → hCaptcha Storefront (the module adds a parallel hCaptcha Admin Panel section for backend forms).
  3. Paste your keys, pick Theme (Light/Dark) and Size (Normal/Compact), set the mode to Always on or Invisible, save, and flush cache.

Heads up. Grasch_HCaptcha is built on top of the native Magento_ReCaptcha* modules. They ship enabled in Magento 2.4.x, but if you’ve disabled any of them (for example Magento_ReCaptchaAdminUi), re-enable before installing — otherwise the module won’t wire itself into the admin login form. Verify with bin/magento module:status | grep ReCaptcha.

Option B — Set up hCaptcha in WebForms

If your forms are built with MageMe WebForms (contact forms, surveys, multi-step wizards, file-upload forms, quote requests), CAPTCHA is configured at the WebForms level — independently of the global Magento reCAPTCHA settings. Use this path when you want per-form on/off control or when your forms are custom WebForms rather than native Magento forms.

Step 1: Get Your hCaptcha Keys

  1. Go to hcaptcha.com and create a free account
  2. Add your site domain in the dashboard
  3. Copy your Site Key and Secret Key

Step 2: Configure WebForms

In Magento Admin, navigate to MageMe → WebForms → Settings.

hCaptcha configuration in WebForms for Magento 2
  1. Set CAPTCHA Mode to Always on or Auto (shows only to suspicious visitors)
  2. Select CAPTCHA Type as hCaptcha
  3. Paste your Site Key and Secret Key
  4. Choose Theme: Light or Dark (matches your store design)
  5. Select Size: Normal or Compact
  6. Save and flush cache

Step 3: Enable Per Form

Each form in WebForms inherits the global CAPTCHA settings. To override per form:

  1. Open the form in MageMe → WebForms → Manage Forms
  2. Go to the CAPTCHA tab
  3. Set Mode to override the global setting if needed
  4. Save the form

hCaptcha will now appear on the form frontend. Test by submitting the form to verify the challenge works correctly.

When to Use Each

Situation Recommended approach
Protect Magento admin login, customer login, contact, reviews, newsletter globally hCaptcha via Grasch_HCaptcha (Option A)
Custom forms built in WebForms (quotes, surveys, file uploads) hCaptcha via WebForms (Option B)
Need both native form coverage AND custom form coverage Install both — they don’t conflict (different config paths)
EU store, GDPR-first hCaptcha (either path) or Cloudflare Turnstile
Already using Cloudflare CDN Cloudflare Turnstile (zero added latency)
Maximum bot protection with risk scoring reCAPTCHA Enterprise (paid) + honeypot
Invisible challenge (no user interaction) Cloudflare Turnstile or reCAPTCHA v3

WebForms supports hCaptcha, reCAPTCHA, and Turnstile as switchable providers on the forms you build — see the full Magento 2 Spam Protection Guide for a side-by-side of all options.

Common Issues & Troubleshooting

  • Grasch module throws “Magento_ReCaptcha* is disabled”. Re-enable the framework: bin/magento module:enable Magento_ReCaptchaUi Magento_ReCaptchaAdminUi Magento_ReCaptchaFrontendUi, then setup:upgrade.
  • hCaptcha widget not rendering on admin login. Clear pub/static and var/view_preprocessed, then bin/magento setup:static-content:deploy -f --area adminhtml.
  • WebForms form still shows reCAPTCHA after switching to hCaptcha. Flush full_page and block_html caches and hard-reload; the rendered widget script is cached per form.
  • Hyva or Breeze theme: widget missing. Both themes load scripts via custom loaders; if a minifier or JS bundler defers the hCaptcha script, initialisation can fail. Disable JS merging under Stores → Configuration → Advanced → Developer and re-test — if the widget appears, exclude the hCaptcha script from your minifier’s bundle list.
  • Approaching the 1M/month limit. Unlikely for most stores, but monitor in the hCaptcha dashboard; if you hit it, switch the mode to Auto so only suspicious visitors see a challenge.

Key Takeaways

  • Privacy-first protection — hCaptcha doesn’t track visitors or share data with ad networks, making it ideal for GDPR/CCPA compliance.
  • Free for most stores — the free tier covers 1 million verifications per month, enough for virtually any Magento store.
  • 3-minute setup — get your keys from hcaptcha.com, paste them into the module config or WebForms settings, done.
  • Two paths, pick the right one — use Grasch_HCaptcha for Magento’s native forms (admin, customer, contact, reviews, newsletter, checkout), and WebForms for custom forms you build yourself. They complement each other.
  • No vendor lock-in — both paths let you switch to reCAPTCHA, Turnstile, or back to hCaptcha without touching form structure.

Frequently Asked Questions

sell Is hCaptcha really free for Magento stores? expand_more

Yes. hCaptcha offers a free tier that includes up to 1 million verifications per month. Most Magento stores never exceed this limit. Paid plans add features like custom branding and priority support, but the free tier is fully functional for spam protection.

palette Does hCaptcha work with Hyva and Breeze themes? expand_more

Yes. Both the Grasch_HCaptcha module and WebForms render hCaptcha using standard JavaScript that is compatible with Hyva and Breeze (Luma-based) themes. The widget loads asynchronously and does not conflict with Alpine.js or Breeze JS frameworks.

extension Is there a free open-source Magento 2 hCaptcha module? expand_more

Yes. The MIT-licensed Grasch_HCaptcha module on GitHub (composer package grasch/module-hcaptcha) adds hCaptcha as a provider on top of Magento’s built-in reCAPTCHA framework. Once installed, hCaptcha protects the admin login, customer login/register/forgot, contact, product reviews, newsletter, send-to-friend, checkout, and coupon forms. Install is a single composer require followed by setup:upgrade. It’s the simplest way to get hCaptcha coverage across all native Magento forms at zero cost.

tune Can I use hCaptcha on some forms and reCAPTCHA on others? expand_more

WebForms uses a global CAPTCHA type setting that applies to all forms. You cannot mix different CAPTCHA providers on different forms simultaneously. However, you can control which forms show CAPTCHA and which do not using per-form CAPTCHA mode settings.

verified_user Is hCaptcha GDPR compliant? expand_more

hCaptcha is designed with privacy as a core principle. It does not use tracking cookies, does not build visitor profiles, and processes minimal data required for bot detection. hCaptcha’s GDPR page details their compliance approach. Many EU-focused stores prefer hCaptcha over reCAPTCHA specifically for this reason.

compare_arrows How does hCaptcha compare to Cloudflare Turnstile? expand_more

Both are privacy-friendly alternatives to reCAPTCHA. Cloudflare Turnstile is invisible (no user interaction required) and integrates seamlessly if you already use Cloudflare CDN. hCaptcha shows a visual challenge but offers a free tier with generous limits. Choose Turnstile for seamless UX, hCaptcha for maximum independence from any single provider.

hub Do I need MageMe WebForms if I already installed Grasch_HCaptcha? expand_more

They cover different surfaces. Grasch_HCaptcha swaps the CAPTCHA provider on Magento’s native forms (admin, customer, contact, review, checkout). WebForms lets you build custom forms — quote requests, multi-step wizards, file uploads, surveys, popup forms — and gives you per-form CAPTCHA control on those. If you only need to protect stock Magento forms, the free module is enough. If you build custom forms too, the two modules run side by side without conflict.

speed Will hCaptcha slow down my Magento store? expand_more

No. The hCaptcha script loads asynchronously and only activates on pages with forms. It adds approximately 30-50KB to the page weight, comparable to reCAPTCHA. Both Grasch_HCaptcha and WebForms load the script only when a form with CAPTCHA enabled is present on the page.

Using WebForms? Share Your Experience!

Vladimir Popov
About the Author
Vladimir Popov
verified Founder & Lead Developer, MageMe

Vladimir Popov is the founder and lead developer of MageMe (ACTEK d.o.o., Ljubljana, Slovenia). He has been building on Magento since 2011, starting with Magento 1 and moving to Magento 2 at its 2.0 beta. He wrote the first versions of every MageMe extension himself and still reviews every release.

His focus is clean, performance-first PHP code that plays nicely with Hyvä, Breeze, and stock Luma themes. He writes most of the technical content on the MageMe blog and answers support tickets personally for complex issues.