With pure WooCommerce, hCaptcha works properly. On your page, you have a non-standard WC Register form, with First Name and Last Name fields added. The form is sending correctly, with hCaptcha field, but it is not verified on the backend.
Could you temporary deactivate plugins one by one (except WC and hCaptcha ) and see when hCaptcha starts works properly? Knowing which plugin is a culprit will help to debug the case and add compatibility with that plugin.
Thank you.
The name fields are custom to our theme, but we do have validation logic in place for those. And the issue is happening on the lost password page where there are no custom fields, not just the registration form, so it seems like something else is going on.
If we need to add additional logic to our validation function to support hCaptcha, could you let me know what that should look like?
Here’s how we call the validation function:
add_filter( 'woocommerce_process_registration_errors', array( $this, 'wwn_validate_account_fields' ) );
and the validation function itself is essentially:
public function wwn_validate_account_fields( WP_Error $errors ): WP_Error {
if ( wp_verify_nonce( sanitize_key( $_POST['woocommerce-register-nonce'] ), 'woocommerce-register' ) ) {
foreach ( $this->extra_fields as $name => $field ) {
// perform validation
}
} else {
return new WP_Error( 'nonce_verification_failed', __( 'Nonce verification failed', 'our-text-domain' ) );
}
return $errors;
}
Thank you.
What do you return after // perform validation?
Please refer to this filter. It should fire earlier than your filter in the theme. And it looks like your code overrides the result of the above mentioned filter.
Could you debug the execution of these two filters and share the results?
I have fixed the issue on my end. Please install new version 4.2.1.
Thank you for the reporting.
That appears to have fixed it – thank you.