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 CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_registration_auth_new_customer', '__return_false' );
Share:

Leave a Reply