Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: WooCommerce account login/logout (not WP account) #305302

    SOLVED:
    I added the following to functions.php.

    /*
     * Add WooCommerce Login/Logout to avia2 menu
     */
    add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
    function add_loginout_link( $items, $args ) {
        if (is_user_logged_in() && $args->theme_location == 'avia2') {
            $items .= '<li><a href="'. get_permalink( wc_get_page_id( 'myaccount' ) ) .'">My Account</a></li>';
            $items .= '<li><a href="'. wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) ) .'">Log Out</a></li>';
        }
        elseif (!is_user_logged_in() && $args->theme_location == 'avia2') {
            $items .= '<li><a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">Log In/Register</a></li>';
        }
        return $items;
    }
    in reply to: View Cart … goes to random pages #302644

    With all of the Plug-ins disabled, except for WooCommerce, the result is the same.

    While hovering over the “cart” icon, the page-id of the cart always changes to the current page being viewed.

Viewing 2 posts - 1 through 2 (of 2 total)