Sunday, October 25, 2020

Woocommerce: My Account Page --> Initial login redirects to orders page like Walmart

 // Redirect initial login straight away to orders page like Walmart

// 

add_action('template_redirect', 'redirect_to_orders_from_dashboard' );

 

function redirect_to_orders_from_dashboard(){

 

if( is_account_page() && empty( WC()->query->get_current_endpoint() ) ){

wp_safe_redirect( wc_get_account_endpoint_url( 'orders' ) );

exit;

}

 

}

No comments: