fbpx

Redirect Vendor to his/her store page on login

WCMp Mangopay Marketplace

Redirect Vendor to his/her store page on login Resolved

Viewing 2 reply threads
  • Author
    Posts
    • #114956
      shirazhussain2015
      Participant

      i want my vendor to be Redirected to his/her store page on login not towards his/her dashboard page kindly guide me how can i do it.
      Thank you.

    • #115037

      Hi,
      Please add this code in the function.php of the current active theme :

      add_filter('login_redirect', 'wp_wcmp_vendor_login_redirect', 99, 3);
      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
                	$vendor = get_wcmp_vendor($user->ID);
                    $redirect_to = $vendor->permalink;
                }
            }
        }
        return $redirect_to; 
      }
      
      add_filter('woocommerce_login_redirect', 'wcmp_vendor_login_redirect', 99, 2);
      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
                    $vendor = get_wcmp_vendor($user->ID);
                    $redirect_to = $vendor->permalink;
                 }
             }
         }
         return $redirect_to;
      }
      Copy

      Regards,

    • #119125

      We have not received any update from you for a long. Hope this ticket is already been resolved.

      We are now closing this ticket. Kindly create a new one if you need any further help.

Viewing 2 reply threads

The topic ‘Redirect Vendor to his/her store page on login’ is closed to new replies.

Buy all Marketplace addons together, check out our Bundle

Buy at Slashed Price