Redirect Newly Registered Vendor to Thankyou page

WCMp Core

Resolved
Viewing 5 reply threads
  • Author
    Posts
    • #193903
      vijay
      Participant

      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);
      }
      }
      }

    • #193915

      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.

    • #193944
      vijay
      Participant

      Hi,
      thanks for the quick reply
      I am not talking about Order, Membership or any

      My 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

      • #193967

        hi,vijay
        we understood your scenario, to solve it please put this following code to your parent theme > functions.php

        add_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

    • #194105
      vijay
      Participant

      Thankyou,
      That Worked

    • #194106

      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.

    • #195903

      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.

Viewing 5 reply threads

The topic ‘Redirect Newly Registered Vendor to Thankyou page’ is closed to new replies.