Reserve Your Free Seat for Our Next WooCommerce Class! Search
Business Bloomer
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • 0
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • Search
  • Contact
  • Cart
WooCommerce Code Snippets Customer Registration My Account

WooCommerce: Deny Automatic Login Upon Registration @ My Account

Last Revised: Aug 2019

STAY UPDATED

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        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 3.7
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_registration_auth_new_customer', '__return_false' );

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Separate Login, Registration, My Account Pages
    There are times when you need to send logged out customers to a Login page and unregistered customers to a standalone Register page. As you…
  • WooCommerce: Add New Tab @ My Account Page
    One of the features of Business Bloomer Club is the provision of Premium WooCommerce Q&A Support to supporters who enroll. So, how to add an…
  • WooCommerce: How To Make A Website GDPR Compliant? (12 Steps)
    Ok, we all know that the EU General Data Protection Regulation (GDPR) will come into force on the 25th May 2018. So the main question…
  • WooCommerce Visual Hook Guide: My Account Pages
    Hey WooCustomizers, the Visual Hook Guide is back 🙂 In this episode, I’ve created a visual HTML hook guide for the WooCommerce Account Pages (there…
  • WooCommerce: Add First & Last Name to My Account Register Form
    Here’s yet another useful PHP snippet – and a mini-plugin alternative with super simple settings – that adds the Billing First Name and Billing Last…

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

18 thoughts on “WooCommerce: Deny Automatic Login Upon Registration @ My Account”

  1. Fredrick
    March 27, 2025

    Hi,

    Is it possible to also deny auto login after password reset??

    If yes, kindly help me out with the snippet please. Thank you

    Reply
    1. Rodolfo Melogli
      April 7, 2025

      Fredrick, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  2. Boutique PcLanD
    July 14, 2022

    Hello,

    Unfortunately the code does not work permanently, I have customers who are not disconnected!

    Weird

    Reply
    1. Rodolfo Melogli
      July 18, 2022

      Yep, that’s weird, I don’t see why it shouldn’t work all the times. Do you have some sort of server-side cache?

      Reply
      1. Boutique PcLanD
        August 17, 2022

        Yes it’s a dedicated server, with php 7.4.30 then apache and ngnix proxy!

        I also have a module that allows the activation of customer accounts, this sends an email to the customer to confirm his mailbox! Maybe it’s a conflict?

        Reply
        1. Rodolfo Melogli
          August 22, 2022

          Could be. Disable all plugins but Woo and switch theme, and test the snippet again

          Reply
  3. sg sg
    April 16, 2021

    How can we do the reverse, login the customers when they checkout in Woocommerce?

    Reply
    1. Rodolfo Melogli
      April 20, 2021

      Wait, doesn’t that work like that already?

      Reply
  4. Mark
    November 5, 2020

    Hi

    Do you perhaps have advice for auto log in for an elementor widget?

    Mark

    Reply
    1. Rodolfo Melogli
      November 25, 2020

      No idea sorry

      Reply
  5. sagarweb
    June 20, 2020

    hi, this works but is there a way to change the message?
    i used a customer registration redirect after registration to redirect to another page but it only worked in php 5 but it doesnt seem to work on php 7

    Reply
    1. Rodolfo Melogli
      June 28, 2020

      Hi there, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  6. Jordan
    February 24, 2020

    This is a great little snippet. Is it possible to use this filter to deny auto login after customer checkout completion (and when a new account is automatically created for the customer)?

    Reply
    1. Rodolfo Melogli
      February 27, 2020

      Hey Jordan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

      Reply
  7. Stef
    August 26, 2019

    This is great Rodolpho! It’s nice to have them confirm in their email in case bots are creating accounts with other people’s emails. I see it often.

    Reply
    1. Rodolfo Melogli
      August 29, 2019

      Great!

      Reply
      1. Serge
        April 10, 2020

        Hi,

        Its a great website and good source of usefull tips and recomendations. However this snippet does not work for me. User still auto login during checkout in Woocommerce.
        I have tried other snippets but none of them work.
        I just don’t understand if I need to enable or disable Woccomerce default function in order to make it work?

        Thanks

        Reply
        1. Rodolfo Melogli
          April 14, 2020

          Try disabling all plugins and theme and use this snippet with latest WooCommerce only. LMK

          Reply
Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Cancel reply

Your email address will not be published. Required fields are marked *


Search WooCommerce Tips

Popular Searches: Visual Hook Guides - Checkout Page - Cart Page - Single Product Page - Add to Cart - Emails - Shipping - Prices - Hosting

Recent Articles

  • WooCommerce: Redirect Empty Paginated Category Pages (404)
  • WooCommerce: Complete Button @ Order Admin
  • WooCommerce: Allow Guest Checkout For Existing Customers
  • WooCommerce: Simplify Free Checkout
  • WooCommerce: Inject Ad After the nth Product @ Shop Page

Latest Comments

  1. Rodolfo Melogli on WooCommerce: Separate Login, Registration, My Account Pages
  2. Rodolfo Melogli on WooCommerce: Complete Button @ Order Admin
  3. Rodolfo Melogli on WooCommerce: Failed Orders Monitor & Temporary Lockdown

Find Out More

  • Become a WooCommerce Expert
  • Business Bloomer Club
  • WooCommerce Blog
  • WooCommerce Weekly
  • Contact

Contact Info

Ciao! I'm Rodolfo Melogli, an Italian Civil Engineer who has turned into an international WooCommerce expert. You can contact me here:

Twitter: @rmelogli

Get in touch: Contact Page

Business Bloomer © 2011-2025 - VAT IT02722220817 - Terms of Use - Privacy Policy

Cart reminder?

x