On WooCommerce My Account page when you click on the logout link or the logout button you may come across this logout confirmation message: “Are you sure you want to logout?” .
This is not only annoying for your customers but also bad for your overall store user experience.
In the next few steps, I will guide you on how to remove logout confirmation WooCommerce message using a plugin and a code snippet.
Remove Logout Confirmation WooCommerce
The easy way to remove the WooCommerce logout confirmation is using the plugin that is freely available in the WordPress repository.
The following is the plugin that you should install and activate to remove logout confirmation notice in WooCommerce :
If you do not like to use the plugin for WooCommerce customization, especially for small changes that do not warrant to have a plugin ; adding a custom code snippet to the functions.php of your WooCommerce child theme can be a good alternative.
Before you add a code snippet to your theme you need to be aware of the dangers of crushing your site and its recommended you always have backup copy of your theme before you can begin the customization.
Use the code snippet in your child theme functions.php to remove this logout confirmation message :
function storemizer_remove_logout_confirmation($action, $result) { if ($action == "log-out" && !isset($_GET['_wpnonce'])) { $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''; $location = str_replace('&', '&', wp_logout_url($redirect_to));; header("Location: $location"); die(); } add_action('check_admin_referer', 'storemizer_remove_logout_confirmation', 10, 2);