boxtwentytwo/module-cloudflare-turnstile

Adds Cloudflare Turnstile support to Magento 2

Installs: 46

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 1

Forks: 3

Open Issues: 0

Type:magento2-module

pkg:composer/boxtwentytwo/module-cloudflare-turnstile

1.0.0 2025-06-05 19:06 UTC

This package is auto-updated.

Last update: 2025-12-24 12:57:35 UTC


README

Hyvä Compatible

A module for Magento 2 that extends the built-in reCAPTCHA support to add Cloudflare Turnstile, an alternative privacy-friendly solution.

The documentation for Cloudflare Turnstile can be found here.

Features

  • Supports Luma and Hyvä storefronts
  • Configurable widget size, theme (light/dark), and language
  • Works in all the places Magento's reCAPTCHA solution does, including:
    • Customer login form
    • Forgotten password form
    • New customer account form
    • Contact us form
    • Product review forms
    • Newsletter subscription form
    • Checkout
    • Admin login form
    • Admin forgotten password form

Installation

composer require boxtwentytwo/module-cloudflare-turnstile
bin/magento module:enable BoxTwentyTwo_CloudflareTurnstile
bin/magento setup:upgrade

Usage

Configuration

Create a Cloudflare Turnstile site and secret key by following the instructions in the Cloudflare Turnstile documentation.

Keys can be configured in the Magento admin panel, in the same places as the built-in reCAPTCHA configuration:

  • Stores > Configuration > Security > Google reCAPTCHA Admin Panel > Cloudflare Turnstile
  • Stores > Configuration > Security > Google reCAPTCHA Storefront > Cloudflare Turnstile

Activation per form

Activate Cloudflare Turnstile on the desired forms in the same places as Magento's reCAPTCHA configuration:

  • Stores > Configuration > Security > Google reCAPTCHA Admin Panel > Storefront
  • Stores > Configuration > Security > Google reCAPTCHA Storefront > Storefront

Testing

Cloudflare Turnstile provides test keys that can be used to test the integration in a predictable manner. You can find the test keys in the Cloudflare Turnstile documentation.

Troubleshooting

Hyvä

In some cases, custom themes may override the display of the Turnstile widget. If, after activation from the admin panel, the widget does not appear on the forms, please check your theme's templates to ensure the widget is being called for.

For the contact form, as an example, make sure the following lines are present in the template:

<?php
use Hyva\Theme\ViewModel\ReCaptcha;

$recaptcha = $block->getData('viewModelRecaptcha');
?>
<?= $recaptcha ? $recaptcha->getInputHtml(ReCaptcha::RECAPTCHA_FORM_ID_CONTACT) : '' ?>

Other constants are defined in Hyvä's reCAPTCHA view model.

Contributing

Contributions are welcomed and encouraged. Please feel free to submit an issue or pull request if you find a bug or have a feature request.

Credits

Copyright (C) Sam Cleathero 2025. Licensed under GPLv3.