Disable “Are you sure you want to log out” message in WooCommerce

Do you think your customers get annoyed when they see this ” Are you sure you want to log out ” message after they click log out button?


At least I get annoyed by this unnecessary process which serves no real purpose.(at least not for me)

Good news is you can easily disable this, I’ll show you how.


Are you sure you want to log out message on woocommerce acconnt page


Disable “Are you sure you want to log out” Message.

All you have to do is add the following code snippet in your theme’s functions.php file


This checks if the logout endpoint is set.

And if it is…

It will log the user out straight away and redirects to the My Account page.

You can add any URL in place of wc_get_page_permalink( ‘myaccount’ ) ( in line no.12) for a other redirect location.

Where to add this code?

You need to paste this code into your theme’s functions.php file. Which you can find in Dashboard >> Appearance >> Editor or You can access the file via FTP.

Just go to directory where you Install WordPress >> Wp-Content folder >> Themes >> Your active theme folder >> functions.php

Why You Should Disable this feature

Short answer: For user experience

Last Year, WooCommerce update prompts a message when a customer clicks the “logout” button in their account, they see a message: Are you sure you want to log out


In some themes, This message is so dull that it’s almost impossible to see the message box, especially on mobile phones.

When this happens to me the very first time I thought my website is broken and there is a problem with WooCOmmerce Cache etc, etc, etc.

After few tries, I noticed this annoying message at the bottom of the my-account page in light green color.

which was almost impossible to notice. And nobody will try to read content on the account page.

But visitors will think that your website is broken and once they have this doubt they might not even return to shop again on your website and abandon your website forever without logout.

What do you think, Have any question? Don’t forget to leave a comment below.

If you liked this article, then please follow us on Facebook for WordPress tutorials. You can also find us on Twitter and Google.

Leave a Reply

Notify of