Menu Close

WooCommerce: Custom Logout Redirect @ My Account

default

Whenever a customer logs out from WooCommerce, they are redirected to the My Account page URL.

But when you use separate Login and Registration pages, or whenever you have custom landing pages you wish your customers to see instead of the default My Account page, we can set a custom URL by code and safely redirect the just-logged-out customer there. Here’s the quick fix – enjoy!

Tired of redirecting logged out customers to the My Account page? Here’s a quick PHP snippet so that you can define a custom redirect URL

PHP Snippet: Redirect Logged Out Customers to Custom URL @ My Account

/**
 * @snippet       Custom Redirect for Logouts @ WooCommerce My Account
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_logout_default_redirect_url', 'bbloomer_redirect_after_woocommerce_logout' );

function bbloomer_redirect_after_woocommerce_logout() {
   return 'https://example.com/see-you-soon';
}
View Source
Posted in WooCommerce Tips