Woocommerce login URL

I have a custom page for login in WordPress with Woocommerce integrated, and need that when a user click on my-account page, instead of using the login form from woocommerce, redirect to my custom login url.

my-account page only must be seen in case the user is logged in,else, I prefer the login and registering process be managed in /login/ and /register/ urls.

Read More

How can I accomplish this?

Related posts

2 comments

  1. Try this code:

    function redirect_login_page(){
            if(is_user_logged_in()){
                return;
            }
            global $post;
            // Need for checking if this page equals wp-login.php
            
            // permalink to the custom login page
            $login_page  = get_permalink( 'CUSTOM_LOGIN_PAGE_ID' );
          
            if( has_shortcode($post->post_content, "woocommerce_my_account") ) {
                wp_redirect( $login_page );
                exit();
            }
        }
    
    add_action( 'template_redirect','redirect_login_page' );
    
  2. Create Login page and add this code in content.

    [woocommerce_my_account]

    For Registration separate page use this extension.

    WooCommerce Simple Registration

    Create registration page after active plugin add code

    [woocommerce_simple_registration]

Comments are closed.