Home » WooCommerce: Deny Automatic Login Upon Registration @ My Account

WooCommerce: Deny Automatic Login Upon Registration @ My Account

by Tutor Aspire

If you’ve enabled customer registration on the My Account page, you will know that a new user is automatically logged in as soon as they successfully register.

This is great – however in certain cases it could be “dangerous” (for example, if you need to manually approve each user).

As I was searching through the WooCommerce plugin code, I found a great action filter that can immediately stop this from happening – I love one-liners! So, here’s the quick fix.

Right after registration, user is not logged in and a success notification is displayed instead.

PHP Snippet: Deny Auto Login After Registration @ WooCommerce My Account

/**
 * @snippet       Deny Login Upon Registration @ WooCommerce My Account
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.7
 * @donate $9     https://tutoraspire.com
 */

add_filter( 'woocommerce_registration_auth_new_customer', '__return_false' );

You may also like