From 1aa7c404dae63c9518468fe9b579fad819f8d871 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 13 Sep 2026 18:32:43 +0000
Subject: [PATCH] =Single Event page setup done through the new Event block. Currently working on the Simple Calendar block setup

---
 inc/integrations/services/Cloudflare.php |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/inc/integrations/services/Cloudflare.php b/inc/integrations/services/Cloudflare.php
index 4f1a98b..b8b9278 100644
--- a/inc/integrations/services/Cloudflare.php
+++ b/inc/integrations/services/Cloudflare.php
@@ -49,6 +49,9 @@
 	protected function initialize(): void
 	{
 		// TODO: Implement initialize() method.
+		add_action('woocommerce_review_order_before_submit', [$this, 'addToCheckout']);
+		add_action('wp_enqueue_scripts', [$this, 'enqueueOnCheckout']);
+		add_action('woocommerce_checkout_process', [$this, 'checkoutTurnstile']);
 	}
 
 	public function getServiceDescription():string
@@ -188,4 +191,23 @@
 		}
 		return $result['success'] ?? false;
 	}
+
+	public function enqueueOnCheckout():void
+	{
+		if (function_exists('is_checkout') && is_checkout()) {
+			self::enqueueTurnstileScripts();
+		}
+	}
+	public function addToCheckout():void
+	{
+		self::renderTurnstile();
+	}
+	public function checkoutTurnstile():void
+	{
+		$verified = $this->verifyTurnstile();
+		if (!$verified && function_exists('wc_add_notice')) {
+			wc_add_notice('Security check failed. Please try again', 'error');
+			return;
+		}
+	}
 }

--
Gitblit v1.10.0