WCMp Core
Tagged: Redirect Vendor
-
AuthorPosts
-
-
June 29, 2023 at 3:17 PM #193903vijayParticipant
Hi Team,
I am trying to redirect newly Registered and Pending Vendors to Thankyou page.i tried below code but it was redirecting while login only,
can we update the code for Newly registered vendor also
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 (isset($user->roles) && is_array($user->roles)) {
//check for vendor
if (in_array(‘dc_pending_vendor’, $user->roles)) {
// redirect them to the default place
$url = network_home_url() . ‘/vendor-thankyou’;
wp_redirect ( $url);
}
}}
add_filter(‘woocommerce_login_redirect’, ‘wcmp_vendor_login_redirect’, 99, 2);
function wcmp_vendor_login_redirect($redirect_to, $user){
//is there a user to check?
if (isset($user->roles) && is_array($user->roles)) {
//check for vendor
if (in_array(‘dc_pending_vendor’, $user->roles)) {
// redirect them to the default place
$url = network_home_url() . ‘/vendor-thankyou’;
wp_redirect ( $url);
}
}
} -
June 29, 2023 at 8:34 PM #193915Sangita Support SquadKeymaster
Thanks for reaching out to us.
You are using the correct hooks.
But according to WooCommerce’s flow, one user is redirected to the thank you page only after placing an order successfully.
Now if you have the MultiVendorX Pro, and Marketplace Membership module enabled, then the vendor needs to subscribe to a membership plan while registering on the site. This way, he will have to complete an order for the subscription plan and only after completing the order successfully, he will be redirected to the thank you page.
Now can you please explain exactly what flow you are looking for, so we can assist you with this.
-
June 30, 2023 at 11:26 AM #193944vijayParticipant
Hi,
thanks for the quick reply
I am not talking about Order, Membership or anyMy scenario is like
1. I will send the Visitor to Vendor registration page whois interested to sell goods with us
2. Visitor will fill the form
3. Visitor will clcik on Register Butoon
4. Newly registered Vendor is on the user role of “Pending_Vendor” because i approve Vendors Manually(Till here flow is working properly, i want to change flow after this)
now the newly registered vendor(Pending_Vendor) is Redirecting to Vendor dashboard with a message “Congratulations! You have successfully applied as a Vendor. Please wait for further notifications from the admin.”
i want change the redirection to another Page, that page name is vendor-thankyou.
i dont want to show the Dashboard until vendor is approved.i hope I have explained clearly
-
June 30, 2023 at 8:13 PM #193967NerdySupportExpert MoumitaKeymaster
hi,vijay
we understood your scenario, to solve it please put this following code to your parent theme > functions.phpadd_action( ‘template_redirect’, ‘template_redirect_func’ );
function template_redirect_func() {
$user = wp_get_current_user();
if (is_user_logged_in() && is_vendor_dashboard()) {
if (isset($user->roles) && is_array($user->roles)) {
//check for vendor
if (in_array(‘dc_pending_vendor’, $user->roles)) {
// redirect them to the default place
$url = //put your redirect link here// ;
wp_redirect ( $url);
}
}
}
}I hope it helps you, please let us know that it fulfilles your desired workflow.
thanks & regards
-
-
July 5, 2023 at 3:30 PM #194105vijayParticipant
Thankyou,
That Worked -
July 5, 2023 at 3:43 PM #194106Sangita Support SquadKeymaster
Happy to hear that.
It would be really great if you can give us 5/5 review here: https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post
This would motivate the team further to do their job more efficiently. -
September 5, 2023 at 2:33 PM #195903Sangita Support SquadKeymaster
Its been a while and we have not heard back from you. We are closing this thread as of now. If you need help or face issue in future please open a new thread.
-
-
AuthorPosts
The topic ‘Redirect Newly Registered Vendor to Thankyou page’ is closed to new replies.