1. Home
  2. WC Vendors Marketplace
  3. Code Snippets
  4. Redirecting Vendors to Vendor Dashboard on Login

Redirecting Vendors to Vendor Dashboard on Login

WooCommerce, by default, will redirect all users to their /my-account/ after they login.  That can be confusing to new vendors.  Add this code to your themes functions.php file and it will redirect any Vendors to their Vendor Dashboard instead.

add_filter('woocommerce_login_redirect', 'login_redirect', 10, 2);
function login_redirect( $redirect_to, $user ) {
// WCV dashboard — Uncomment the 3 lines below if using WC Vendors Free instead of WC Vendors Pro
if (class_exists('WCV_Vendors') && WCV_Vendors::is_vendor( $user->ID ) ) {
$redirect_to = get_permalink( get_option( 'wcvendors_vendor_dashboard_page_id' ) );
}

return $redirect_to; 
}

This is an option in settings for WC Vendors Pro version 1.5.0 and above.

filters

Updated on May 31, 2018

Was this article helpful?