Woocommerce My-Account / Login Links - by Sporbillis

This topic has 13 replies, 2 voices, and was last updated 7 years, 10 months ago ago by Eva Kemp

  • 12 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    May 18, 2016 at 11:17

    Hello,

    “Sign In” and “My Account” links redirect to one woocommerce page, but you want to redirect them to different pages.
    We don’t provide such customization.
    As this is Woocommerce configuration you may contact their support or search for some of extensions they provide.

    Regards,
    Eva Kemp.

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 11:34

    Can you show me a way of disabling the sign in link that is currently active and replacing it with a different one? I cant think of any easier option. Disable sign in but use a new link at it’s place. That way we can achieve what we want. Please help

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 12:19

    PLEASE see this reply that you gave me in my other post ( before you closed it ). Can you please explain to me what this code does and how to put it in the child theme ?

    Hello,
    
    Please edit the file wp-content/themes/legenda/framework/theme-functions.php in line 1300, edit the code
    <?php if(class_exists('Woocommerce')): ?><li class="login-link"><a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>"><?php _e( 'Sign In', ETHEME_DOMAIN ); ?></a></li><?php endif; ?>
    
    Replace the string <?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?> with your url of the page you need.
    
    So it will be like this:
    <?php if(class_exists('Woocommerce')): ?><li class="login-link"><a href="http://domain.com/some_page"><?php _e( 'Sign In', ETHEME_DOMAIN ); ?></a></li><?php endif; ?>
    
    Best regards,
    Jack Richardson.
    Avatar: Eva
    Eva Kemp
    Support staff
    May 18, 2016 at 13:33

    Hello,

    In the previous topic you were told how to add code in child theme:

    To add the code to child theme you need copy whole function code and add it to functions.php file in the child theme:

    if(!function_exists('etheme_top_links')) {
        function etheme_top_links() {
            ?>
                <ul class="links">
                    <?php if ( is_user_logged_in() ) : ?>
                        <?php if(class_exists('Woocommerce')): ?> <li class="my-account-link"><a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>"><?php _e( 'Your Account', ETHEME_DOMAIN ); ?></a>
                        <div class="submenu-dropdown">
                            <?php  if ( has_nav_menu( 'account-menu' ) ) : ?>
                                <?php wp_nav_menu(array(
                                    'theme_location' => 'account-menu',
                                    'before' => '',
                                    'after' => '',
                                    'link_before' => '',
                                    'link_after' => '',
                                    'depth' => 4,
                                    'fallback_cb' => false
                                )); ?>
                            <?php else: ?>
    		                    <h4 class="a-center install-menu-info">Set your account menu in <em>Apperance > Menus</em></h4>
                            <?php endif; ?>
                        </div>
                    </li><?php endif; ?>
                            <li class="logout-link"><a href="<?php echo wp_logout_url(home_url()); ?>"><?php _e( 'Logout', ETHEME_DOMAIN ); ?></a></li>
                    <?php else : ?>
                        <?php
                            $reg_id = etheme_tpl2id('et-registration.php');
                            $reg_url = get_permalink($reg_id);
                        ?>
                        <?php if(class_exists('Woocommerce')): ?><li class="login-link"><a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>"><?php _e( 'Sign In', ETHEME_DOMAIN ); ?></a></li><?php endif; ?>
                        <?php if(!empty($reg_id)): ?><li class="register-link"><a href="<?php echo $reg_url; ?>"><?php _e( 'Register', ETHEME_DOMAIN ); ?></a></li><?php endif; ?>
                    <?php endif; ?>
                </ul>
            <?php
        }
    }

    and edit only this part:
    <?php if(class_exists('Woocommerce')): ?><li class="login-link"><a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>"><?php _e( 'Sign In', ETHEME_DOMAIN ); ?></a></li><?php endif; ?>

    This code <a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>"> gives the link of My Account page, you can replace it with your url, just replace <?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?> with your page link.

    If you have difficulties editing the code we suggest you to hire a freelancer who will make all customizations you need.

    Regards,
    Eva Kemp.

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 13:35

    So this code edits the Sign In button ? Or the my account button too ?

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 13:41

    Where is the function.php file in the ftp? The one i found has only 3lines of code in it!

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 13:59

    fixed it. thanks

    Avatar: Eva
    Eva Kemp
    Support staff
    May 18, 2016 at 14:02

    Hello,

    As you can see there is title “Sign In” in the code:
    <?php if(class_exists('Woocommerce')): ?><li class="login-link"><a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>"><?php _e( 'Sign In', ETHEME_DOMAIN ); ?></a></li><?php endif; ?>
    so it edits Sign In link.

    Have you created child theme?
    Create it and create functions.php file inside the child theme folder.

    Again if you have difficulties would be better if you hire a developer.

    Regards,
    Eva Kemp.

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 14:03

    I have created a child theme and i added the code we discussed from editor, is that correct?

    Avatar: Eva
    Eva Kemp
    Support staff
    May 18, 2016 at 14:09

    Hello,

    Yes, it’s correct.

    Regards,
    Eva Kemp.

    Avatar: Sporbillis
    Sporbillis
    Participant
    May 18, 2016 at 14:10

    Thanks, this means if i update, woocommerce, the theme or wordpress it won’t get lost?

    Avatar: Eva
    Eva Kemp
    Support staff
    May 18, 2016 at 14:55

    Hello,

    If the changes are made in child theme you won’t lose them.

    Regards,
    Eva Kemp.

  • Viewing 13 results - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.