Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to unhook it from the woocommerce checkout page? #29

Open
luboslives opened this issue Sep 7, 2022 · 3 comments
Open

How to unhook it from the woocommerce checkout page? #29

luboslives opened this issue Sep 7, 2022 · 3 comments

Comments

@luboslives
Copy link

Hi, I'm at a loss here so I thought I'd go to the source. I've tried unhooking the captcha from the login form inside the woo checkout page by removing every action and script I could find in the source, and hooking into plugins_loaded, init and wp_loaded, yet still the captcha just keeps loading into the form:

function cdnrec_remove_captcha_from_checkout () {

	if ( ! is_checkout() ) {
		return;
	}

	// unhook all mentions of nocaptcha_form
	remove_action('login_form', array('LoginNocaptcha', 'nocaptcha_form'));
	remove_action('register_form', array('LoginNocaptcha', 'nocaptcha_form'), 99);
	remove_action('signup_extra_fields', array('LoginNocaptcha', 'nocaptcha_form'), 99);
	remove_action('lostpassword_form', array('LoginNocaptcha', 'nocaptcha_form'));

	remove_action('woocommerce_login_form', array('LoginNocaptcha', 'nocaptcha_form'));
	remove_action('woocommerce_lostpassword_form', array('LoginNocaptcha', 'nocaptcha_form'));
	remove_action('woocommerce_register_form', array('LoginNocaptcha', 'nocaptcha_form'));

	// others?
	remove_action('woocommerce_register_post', array('LoginNocaptcha', 'woo_authenticate'), 10, 3);

	// scripts and styles
	wp_dequeue_script('login_nocaptcha_google_api');
	wp_dequeue_style('login_nocaptcha_css');
	remove_action('wp_head', array('LoginNocaptcha', 'enqueue_scripts_css'));
	remove_action('login_enqueue_scripts', array('LoginNocaptcha', 'enqueue_scripts_css'));
}

// add_action( 'plugins_loaded', 'cdnrec_remove_captcha_from_checkout');
// add_action( 'init', 'cdnrec_remove_captcha_from_checkout');
// add_action( 'wp_loaded', 'cdnrec_remove_captcha_from_checkout');

I also tried a priority of 99, no change. What's the secret to unhooking it?

@cyberscribe
Copy link
Owner

cyberscribe commented Sep 7, 2022 via email

@luboslives
Copy link
Author

luboslives commented Sep 7, 2022

This plugin only places a captcha on the main/woo login prompts, password reset, and registration —not the checkout page itself (unless you are talking about a login prompt in the checkout flow?)

Yes that's the one.

In this case, and possibly in general, the checkout page won't load anything other than "Your cart is empty" unless you have something to check out with. So I figure unless a bot is clever enough to add in-stock items to their cart before trying to hit the form from the checkout page - and why would they? - the captcha only increases the weight and loading time of the checkout page.

@cyberscribe
Copy link
Owner

cyberscribe commented Sep 7, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants