Magento 2 Spam Protection: A Comprehensive Guide to Securing Your Forms (2027 Updated)

Spam submissions bury real customer enquiries, trigger email rate limits, and make your admin grid unusable. If you’ve ever deleted 200 junk entries to find one real order request, this guide fixes that.
Magento 2 form spam protection prevents bots and automated scripts from flooding your store’s forms with junk submissions. WebForms Suite (WebForms 4) protects the forms it builds with a CAPTCHA check from Google reCAPTCHA v2, v3 or Enterprise, hCaptcha or Cloudflare Turnstile, and with a list of blocked email addresses. A check that isn’t set up refuses submissions instead of letting spam through. For Magento 2.4.6 to 2.4.9.
The Growing Threat of Form Spam in Magento 2
Form spam fills your submission list with junk, wastes staff time and can push you over email sending limits. It hits every form a store has, especially the contact us form. A CAPTCHA check and a list of blocked email addresses stop most automated submissions.
Form spam can lead to numerous issues, including:
- warning Cluttered databases with false information
- trending_down Increased server load and potential downtime
- sentiment_very_dissatisfied Compromised user trust and site reputation
- access_time Time wasted on managing and cleaning up spam submissions
As spammers become more sophisticated, it's crucial to implement effective measures to safeguard your Magento 2 forms.
Common Spam Protection Methods for Magento 2
Store owners use several methods against form spam. The most common are:
verified_user CAPTCHA
Asks visitors to prove they’re a person before the form is sent
block Blocked email addresses
Refuses submissions from known spam senders and domains
bug_report Honeypot fields
Hidden fields that people leave empty and bots fill in
dns IP blocking
Blocks requests from known spam sources, usually on the server or firewall
WebForms uses the first two: a CAPTCHA check and a list of blocked email addresses. A submission stopped by either one isn’t saved, so it never reaches your Inbox and sends no email.
Advanced Spam Prevention with WebForms Suite
WebForms Suite is a form builder extension for Magento 2. You create custom forms in a drag-and-drop builder, read the submissions in one Inbox and protect every form with the same spam settings. The current version is WebForms 4.
build Drag-and-drop builder
45 form elements, 36 of them field types, and 27 starter templates.
device_hub Conditional logic
Show and hide fields, sections and the Submit button based on the visitor’s answers.
security Spam protection
A CAPTCHA from three services and a blocked email list, for guests only or for everyone.
people Customer registration
Registration forms that create customer accounts, with the same CAPTCHA and blocked email list.
email Notifications and Inbox
Emails to your team and the customer. Statuses, assignment and notes in one Inbox.
cloud_upload File uploads
File and Image fields with size limits: 5000 KB and 1000 KB by default.
CAPTCHA Options for Robust Spam Prevention
WebForms works with three CAPTCHA services. You pick one per store view in CAPTCHA Provider.
reCAPTCHA v2
- check A check visitors can see
- check Theme: Standard or Dark
- check Site Key and Secret Key
reCAPTCHA v3 and Enterprise
- check Invisible to visitors
- check Score from 0 (bot) to 1 (person)
- check Enterprise can show a checkbox instead
Cloudflare Turnstile
- check Theme: Auto, Light or Dark
- check Widget size: Normal or Compact
- check Site Key and Secret Key
hCaptcha
- check Theme: Light or Dark
- check Widget size: Normal, Compact or Invisible
- check Optional bot score limit
Whichever service you choose, CAPTCHA is off until you turn it on, and you decide who gets the check.
GDPR Considerations
A CAPTCHA works in the visitor’s browser, so it matters for your privacy policy:
The check loads early
The CAPTCHA service loads in the visitor’s browser while the form is open, before the visitor submits it: Google for reCAPTCHA, hCaptcha, or Cloudflare for Turnstile. That request can share network and device data, such as the IP address, with the provider.
Consent tools can block it
A cookie consent tool that holds back other companies’ scripts until the visitor agrees can stop the check. The visitor then sees “The security check is not complete yet.” and can’t send the form.
Name the service
Tell visitors in your privacy policy which service checks your forms. Read that service’s privacy terms and data processing agreement before you choose it.
WebForms doesn’t decide this for you: it lets you pick the service that your privacy policy can cover. For the other outside services a form can load, see Who sees submissions and files in the WebForms docs.
Secure Magento 2 Forms: Implementing Robust Spam Filters
Setting up spam protection in WebForms 4 has three parts: connect a CAPTCHA service, choose who must pass the check, and, if you need it, block email addresses. The steps follow the Protect forms with CAPTCHA guide in the WebForms docs.
| reCAPTCHA v2 | reCAPTCHA v3 | reCAPTCHA Enterprise | hCaptcha | Turnstile | |
|---|---|---|---|---|---|
| Runs the check | hCaptcha | Cloudflare | |||
| What visitors see | A visible check | No puzzle (invisible) | Invisible, or the “I’m not a robot” checkbox | Normal, Compact or Invisible widget | Normal or Compact widget |
| Keys you enter | Site Key, Secret Key | Site Key, Secret Key | Site Key, API Key, Project ID | Site Key, Secret Key | Site Key, Secret Key |
| Score setting | — | Minimum Human Score | Minimum Human Score | Maximum Bot Score | — |
| Look | Theme: Standard, Dark | Badge: Inline, Bottom Right, Bottom Left | Badge: Inline, Bottom Right, Bottom Left | Theme: Light, Dark | Theme: Auto, Light, Dark |
Which one to pick: if visitors shouldn’t see a check, use reCAPTCHA v3, reCAPTCHA Enterprise, or hCaptcha with Widget Size set to Invisible. If you prefer a service other than Google, use hCaptcha or Turnstile. You can change the service later; the forms stay the same.
Connect a CAPTCHA service
Create an account with the service first. It gives you the keys for your store.
- Go to Stores → Configuration → MageMe Extensions → WebForms. To set up one store view, select it in Scope first.
- Click Spam Protection to expand it.
- In CAPTCHA Provider, select reCAPTCHA, hCaptcha or Turnstile. The page then shows only the settings of that service.
- For reCAPTCHA, select the version of your keys in reCAPTCHA Version: v2, v3 (invisible) or Enterprise.
- Paste your keys. The settings of each service are below.
- Optionally change how the check looks, for example Theme or Widget Size.
- Click Save Config. If a key the selected service needs is empty, the page doesn’t save and names the missing keys.
Each service also has two messages you can change: the Rejected Check Message, shown when the service rejects the visitor’s answer, and the Service Error Message, shown when the service can’t complete the check. Every setting is listed in Settings: Spam Protection.
1. Google reCAPTCHA v2
Get the keys in the reCAPTCHA admin console and choose v2 when you register your site. In WebForms, select v2 in reCAPTCHA Version, paste the Site Key and Secret Key and pick a Theme: Standard or Dark.
2. Google reCAPTCHA v3 (invisible)
reCAPTCHA v3 shows no puzzle. Google rates each visitor from 0 (likely a bot) to 1 (likely a person). Create v3 keys at Google, then in WebForms:
- Select v3 (invisible) in reCAPTCHA Version.
- Paste the Site Key and Secret Key. Each reCAPTCHA version keeps its own keys, and only the keys of the selected version are used.
- Choose the Invisible Badge Position: Inline, Bottom Right or Bottom Left.
- Leave Minimum Human Score at 0.5 unless you have a reason to change it. A submission passes only with a score above this value; a score equal to it is rejected. The setting applies to the whole store, so change it at Default Config.
3. Google reCAPTCHA Enterprise
Select Enterprise in reCAPTCHA Version and fill in Site Key,
API Key and Project ID. Verification Action must match the action
name set for the key; it starts as webforms. Enterprise uses a score like v3, with the same
Minimum Human Score and badge position. Set Checkbox Challenge to
Yes to show the “I’m not a robot” checkbox instead; the score is then
ignored.
4. hCaptcha
hCaptcha is set up the same way: select hCaptcha in CAPTCHA Provider and paste the Site Key and Secret Key from hcaptcha.com. Widget Size can be Normal, Compact or Invisible. Maximum Bot Score (0.5 by default) works the other way round from reCAPTCHA: it applies only when hCaptcha sends a score, and a submission is rejected only with a score above it.
For a step-by-step setup and a comparison with reCAPTCHA, see our guide How to Add hCaptcha to Magento 2 Forms.
5. Cloudflare Turnstile
Get the keys in your Cloudflare account (see Turnstile: get started). In WebForms, select Turnstile in CAPTCHA Provider, paste the Site Key and Secret Key, and choose a Theme (Auto, Light or Dark) and a Widget Size (Normal or Compact).
Choose who must pass the check
On the same Spam Protection page, set Require CAPTCHA for and click Save Config. On a new installation it is Disabled, so no form asks for a CAPTCHA.
- Guests Only asks visitors who aren’t signed in to a customer account.
- All Visitors asks everyone.
- Disabled asks nobody, unless a form says otherwise.
To use a different rule on one form, go to Content → WebForms → Manage Forms, click the form’s name, click User Experience and change Captcha Mode from Use Store Configuration to Guests Only, All Visitors or Disabled. Then click Save. The form’s rule wins over the store-wide one, so you can leave the store at Disabled and protect only the form that attracts spam.
The check appears where the form’s Captcha element sits, right above Submit unless you move it in the builder. A passed check counts for one submission only. The same rule works on every WebForms form, including a contact form, a customer registration form or a newsletter signup form.
The Captcha element in the form builder shows the form’s Captcha Mode and whether the service is set up.
Block email addresses
For spam that keeps coming from the same senders, fill in Blocked Email Addresses in the same Spam Protection group, one entry per line, and click Save Config:
- A full address, such as
offers@example.net, blocks that address only. - A pattern such as
*@example.comblocks every address at that domain. - A pattern between slashes, such as
/@example\.com$/i, is a regular expression.
For full addresses and patterns without slashes, upper and lower case don’t matter; between slashes, the
i at the end does that. Only Email fields are checked, and the list is the same
for every form of the store view. The visitor sees “E-mail address is blocked:” followed by the
address, so a sender can try another address. Use the list together with a CAPTCHA. Details:
Blocked email addresses.
When the keys are missing
A form shows a CAPTCHA only after both keys of the selected service are filled in. Without them, a form that asks for a CAPTCHA refuses every submission with “Captcha is not set up on this store. Please contact the store owner.” Spam doesn’t get through, but neither do your customers. The admin shows a system message that names the store view with missing keys and links to the settings. In the form builder, the Captcha element’s panel says the check is not running and names the missing keys.
Conclusion
Spam protection in WebForms 4 uses a few settings: one CAPTCHA service per store view, a store-wide rule for who must pass the check, a different rule on the forms that need one, and a list of blocked email addresses. A check without keys refuses submissions, so a missing setting doesn’t let spam through.
WebForms Suite costs €199 for Magento Open Source and €499 for Adobe Commerce, as a one-time payment with 12 months of updates and support. There is no free version or trial: try the live demo before you buy.
Key Takeaways
- Three services — Google reCAPTCHA (v2, v3 or Enterprise), hCaptcha and Cloudflare Turnstile, one per store view.
- Off until you turn it on — Require CAPTCHA for is Disabled on a new installation.
- Store-wide or per form — Guests Only, All Visitors or Disabled; a form’s Captcha Mode wins over the store setting.
- Invisible options — reCAPTCHA v3 and Enterprise score visitors without a puzzle; hCaptcha has an Invisible widget size.
- Missing keys — a form that asks for a CAPTCHA without keys refuses submissions instead of letting spam through.
- Blocked email addresses — refuse known senders and whole domains typed into Email fields.
FAQs: Securing Magento 2 Forms Against Spam
For Magento’s built-in contact form, go to Stores → Configuration → Security → Google reCAPTCHA Storefront, enter your reCAPTCHA keys, set Enable for Contact Us to the reCAPTCHA type of your keys and save. For a contact form built with WebForms Suite, go to Stores → Configuration → MageMe Extensions → WebForms, expand Spam Protection, select reCAPTCHA in CAPTCHA Provider, select the version of your keys in reCAPTCHA Version and paste the keys. Set Require CAPTCHA for to Guests Only or All Visitors, or set the form’s own Captcha Mode, and save.
Google reCAPTCHA v2, v3 and Enterprise, hCaptcha and Cloudflare Turnstile. You choose who has to pass the check, guests only or all visitors, for the whole store or for one form. CAPTCHA is off until you turn it on. You can also block email addresses and address patterns.
Yes. Select v3 (invisible) or Enterprise in reCAPTCHA Version. Visitors get no puzzle: the service rates each visitor from 0 (likely a bot) to 1 (likely a person), and a submission passes only with a score above Minimum Human Score, 0.5 by default. With hCaptcha, set Widget Size to Invisible.
Yes, for who has to pass the check. Each form has a Captcha Mode in the User Experience section of its settings: Use Store Configuration, Guests Only, All Visitors or Disabled. The form’s rule wins over the store-wide Require CAPTCHA for. The CAPTCHA service, its keys and the blocked email list are the same for every form of a store view.
For a whole store view, set Require CAPTCHA for to Disabled and click Save Config. A form with its own Captcha Mode keeps it, so set Captcha Mode to Disabled on that form too. The Captcha element in the form builder can’t be deleted or switched off: it only marks where the check sits.
First check that the keys of the selected service are filled in for the store view you are looking at. Then check the form’s Captcha Mode and, if it says Use Store Configuration, Require CAPTCHA for. With Guests Only, signed-in customers don’t get the check, so sign out to test. In the form builder, click the form’s Captcha element: its panel says whether the service is configured.
A form that asks for a CAPTCHA refuses every submission with “Captcha is not set up on this store. Please contact the store owner.” Nothing is saved, so spam doesn’t get through either. The admin shows a system message that names the store view with missing keys and links to the settings.
A customer registration form built with WebForms can ask for a CAPTCHA and check the blocked email list. It can also refuse an email address that already has an account, with a link to reset the password. The settings in this guide protect forms built with WebForms.
WebForms lets you choose the service: Google reCAPTCHA, hCaptcha or Cloudflare Turnstile. Whichever you pick, its service loads in the visitor’s browser while the form is open, before the visitor submits it. That request can share network and device data, such as the IP address, with the provider. Name the service in your privacy policy. If a cookie consent tool holds back the service’s script until the visitor agrees, the check can’t finish and the form shows “The security check is not complete yet.”



