Redirect issues when logging in as a vendor account during checkout

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Marketplace (WooCommerce Multivendor Marketplace) Redirect issues when logging in as a vendor account during checkout

Viewing 4 reply threads
  • Author
    Posts
    • #98243
      sho_amano
      Participant

      If I check the “Allow customers to log into an existing account during checkout” setting in Woocommerce, when a customer logs in as a vendor account, they are redirected to the vendor dashboard.

      How can I return to the checkout page while logged in, just like a customer account?

    • #98633
      WCFM Forum
      Member

      HI,

      Please add this code to your site –

      add_filter( 'wcfm_login_redirect', function( $redirect_to, $user ) {
      	if( wcfm_is_vendor( $user->ID ) && is_checkout() ) {
      		$redirect_to = wc_get_checkout_url();
      	}
      	return $redirect_to;
      }, 50, 2 );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      Thank You

    • #104569
      sho_amano
      Participant

      Sorry for replying late.
      I entered the code you wrote, but the result did not change. Is there any mistake in the code? Check it out as I have attached a screen capture of my situation.

      Best regards,
      Sho Amano

      Attachments:
      You must be logged in to view attached files.
    • #105703
      WCFM Forum
      Member

      Hi,

      Please use this revised code –

      add_filter( 'wcfm_login_redirect', function( $redirect_to, $user ) {
      	if( wcfm_is_vendor( $user->ID ) ) {
      		if ( ! empty( $_POST['redirect'] ) ) {
      			$redirect_to = wp_unslash( $_POST['redirect'] );
      		}
      		//$redirect_to = wc_get_checkout_url();
      	}
      	return $redirect_to;
      }, 50, 2 );

      Thank You

    • #124367
      sho_amano
      Participant

      Thank you so much!
      The problem is solved!

Viewing 4 reply threads
  • You must be logged in to reply to this topic.