• Resolved robuph

    (@robuph)


    hi, I want to know how to change the login redirect link. When someone click in a couse buy now option if he is not logged the the login popup come. But after login in or register I want to redirect him directly to checkout page for buying the couse. As i turned off the cart page in my woocommerce. So I want to redirect login user to my checkout page directly. Is it possible?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Md Rashed Hossain

    (@wprashed)

    Dear @robuph

    To redirect to a specific page after login, write a custom redirection function. Currently, there is no built-in feature and a plugin isn’t available.

    Thank you.

    Thread Starter robuph

    (@robuph)

    can you please help me with the custom function please. I am not good with writing.

    • This reply was modified 11 months, 1 week ago by robuph.
    Plugin Support Md. Jobayer Al Mahmud

    (@jobayertuser)

    Dear @robuph
    You can try this code snippet.

    function custom_login_redirect( $redirect_to, $request, $user ) {
    
    // Check if the user is logging in from a Tutor LMS page
    
    if ( function_exists( 'tutor_utils' ) && tutor_utils()->is_tutor_checkout_page() ) {
    
    // If so, redirect to the checkout page after login
    
    return wc_get_checkout_url();
    
    }
    
    // Default to the standard redirect behavior
    
    return $redirect_to;
    
    }
    
    add_filter( 'login_redirect', 'custom_login_redirect', 10, 3 );
    
    // Define a function to modify the registration redirect URL
    
    function custom_registration_redirect( $redirect_to ) {
    
    // Check if the user is registering from a Tutor LMS page
    
    if ( function_exists( 'tutor_utils' ) && tutor_utils()->is_tutor_checkout_page() ) {
    
    // If so, redirect to the checkout page after registration
    
    return wc_get_checkout_url();
    
    }
    
    // Default to the standard redirect behavior
    
    return $redirect_to;
    
    }
    
    add_filter( 'registration_redirect', 'custom_registration_redirect' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Buy now login redirect to checkout’ is closed to new replies.