You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"
Does this snippet (still) work?
Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.
Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!
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.
16 thoughts on “WooCommerce: Deny Automatic Login Upon Registration @ My Account”
Unfortunately the code does not work permanently, I have customers who are not disconnected!
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?
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?
Could be. Disable all plugins but Woo and switch theme, and test the snippet again
How can we do the reverse, login the customers when they checkout in Woocommerce?
Wait, doesn’t that work like that already?
Do you perhaps have advice for auto log in for an elementor widget?
No idea sorry
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
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!
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)?
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!
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.
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?
Try disabling all plugins and theme and use this snippet with latest WooCommerce only. LMK