Hi @keith1025, currently when a vendor gets logged into the site, we direct them to our dashboard page.
But, if you want to change this flow, then you have to do custom code. For this, please use this filter :
woocommerce_login_redirect
login_redirect
Like this?
<?php
add_filter( ‘woocommerce_login_redirect’, ‘login_redirect’, 10, 2 );
Hi @keith1025, add this code to the function.php of the active child theme, to direct vendor to my account page, when they will log into the site :
add_filter('login_redirect', 'wp_wcmp_vendor_login_redirect', 99, 3);
add_filter('woocommerce_login_redirect', 'wcmp_vendor_login_redirect', 99, 2);
function wp_wcmp_vendor_login_redirect($redirect_to, $requested_redirect_to, $user) {
//is there a user to check?
if(class_exists('WCMp')){
if (isset($user->roles) && is_array($user->roles)) {
//check for vendor
if (in_array('dc_vendor', $user->roles)) {
// redirect them to the default place
wp_redirect( get_permalink( get_option('woocommerce_myaccount_page_id')) );
}
}
}
return $redirect_to;
}
function wcmp_vendor_login_redirect($redirect_to, $user){
if(class_exists('WCMp')){
if (isset($user->roles) && is_array($user->roles)) {
//check for vendor
if (in_array('dc_vendor', $user->roles)) {
// redirect them to the default place
wp_redirect( get_permalink( get_option('woocommerce_myaccount_page_id')) );
}
}
}
return $redirect_to;
}