woocommerce.php
WooCommerce integration.
Protects four WooCommerce forms — Checkout, My-Account login, registration
and lost-password — when the master toggle protect_woocommerce and the
respective sub-toggle are on. Reviews are out of scope: they use the
WordPress comment system and are already covered by protect_comments.
Lost-Password is render-only: WooCommerce submits the lost-password form
through WordPress core's retrieve_password(), which fires
lostpassword_post. Our existing core module
(includes/forms/password-reset.php) hooks that action — adding another
verify here would just produce duplicate verification and duplicate events.
Table of Contents
Functions
- creationell_captcha_woocommerce_active() : bool
- Whether any WooCommerce protection applies right now.
- creationell_captcha_wc_checkout_active() : bool
- Whether the WooCommerce checkout protection is active.
- creationell_captcha_wc_checkout_render() : void
- Renders the widget directly before the Place-Order button on the checkout.
- creationell_captcha_wc_checkout_verify() : void
- Verifies the captcha during checkout validation.
- creationell_captcha_wc_login_active() : bool
- Whether the WooCommerce my-account login protection is active.
- creationell_captcha_wc_login_render() : void
- Renders the widget at the bottom of the WooCommerce login form.
- creationell_captcha_wc_login_verify() : mixed
- Verifies the captcha on a WooCommerce my-account login submission.
- creationell_captcha_wc_registration_active() : bool
- Whether the WooCommerce registration protection is active.
- creationell_captcha_wc_registration_render() : void
- Renders the widget at the bottom of the WooCommerce registration form.
- creationell_captcha_wc_registration_verify() : mixed
- Verifies the captcha during WooCommerce my-account registration.
- creationell_captcha_wc_lost_password_active() : bool
- Whether the WooCommerce lost-password render is active.
- creationell_captcha_wc_lost_password_render() : void
- Renders the widget inside the WooCommerce lost-password form.
Functions
creationell_captcha_woocommerce_active()
Whether any WooCommerce protection applies right now.
creationell_captcha_woocommerce_active() : bool
Shared gate that the per-form predicates _wc_*_active() route through —
encapsulates the kill-switch, the class_exists check and the master
toggle so each form predicate just needs to add its own sub-toggle check.
Return values
boolcreationell_captcha_wc_checkout_active()
Whether the WooCommerce checkout protection is active.
creationell_captcha_wc_checkout_active() : bool
Return values
boolcreationell_captcha_wc_checkout_render()
Renders the widget directly before the Place-Order button on the checkout.
creationell_captcha_wc_checkout_render() : void
creationell_captcha_wc_checkout_verify()
Verifies the captcha during checkout validation.
creationell_captcha_wc_checkout_verify(array<string, mixed> $data, mixed $errors) : void
woocommerce_after_checkout_validation fires inside WooCommerce's
process_checkout() after all other validation has run; adding an error
to the passed-through WP_Error aborts the order.
Parameters
- $data : array<string, mixed>
-
Posted checkout data (unused).
- $errors : mixed
-
The checkout
WP_Error(passed by reference of the object).
creationell_captcha_wc_login_active()
Whether the WooCommerce my-account login protection is active.
creationell_captcha_wc_login_active() : bool
Return values
boolcreationell_captcha_wc_login_render()
Renders the widget at the bottom of the WooCommerce login form.
creationell_captcha_wc_login_render() : void
creationell_captcha_wc_login_verify()
Verifies the captcha on a WooCommerce my-account login submission.
creationell_captcha_wc_login_verify(mixed $validation_error, string $username, string $password) : mixed
Returns a WP_Error to fail the login; otherwise returns the incoming
$validation_error value unchanged (so other filters can keep working).
Parameters
- $validation_error : mixed
-
The current validation error (
WP_Error|null|false). - $username : string
-
Submitted username (unused).
- $password : string
-
Submitted password (unused).
creationell_captcha_wc_registration_active()
Whether the WooCommerce registration protection is active.
creationell_captcha_wc_registration_active() : bool
Return values
boolcreationell_captcha_wc_registration_render()
Renders the widget at the bottom of the WooCommerce registration form.
creationell_captcha_wc_registration_render() : void
creationell_captcha_wc_registration_verify()
Verifies the captcha during WooCommerce my-account registration.
creationell_captcha_wc_registration_verify(mixed $errors, string $username, string $email) : mixed
Parameters
- $errors : mixed
-
The current
WP_Errorcarrier from WooCommerce. - $username : string
-
Submitted username (unused).
- $email : string
-
Submitted email (unused).
creationell_captcha_wc_lost_password_active()
Whether the WooCommerce lost-password render is active.
creationell_captcha_wc_lost_password_active() : bool
Return values
boolcreationell_captcha_wc_lost_password_render()
Renders the widget inside the WooCommerce lost-password form.
creationell_captcha_wc_lost_password_render() : void