Home › Forums › General Issues › Redirect Woocommerce Customer based on value assigned to his profile › Reply To: Redirect Woocommerce Customer based on value assigned to his profile
I Got it worked 🙂 … Its working now
function wpdocs_my_login_redirect( $url, $request, $user ) {
if ( $user && is_object( $user ) && is_a( $user, ‘WP_User’ ) ) {
$dc = get_field(‘distribution_center’, ‘user_’.(int) $user->ID);
if ( $user->has_cap( ‘administrator’ ) ) {
$url = admin_url();
}
if ( $user->has_cap( ‘customer’ ) && $dc == ‘BEK’ ) {
$url = home_url( ‘/order-guide-bek/’ );
}
else {
$url = home_url( ‘/members-only/’ );
}
}
return $url;
}
add_filter( ‘login_redirect’, ‘wpdocs_my_login_redirect’, 10, 3 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.