Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author templateinvaders

    (@templateinvaders)

    Hi,

    You can add link to wishlist from my account menu by adding filter for woocommerce_account_menu_items hook. Add following code to functions.php in your child theme:

    <?php
    function tinv_woocommerce_account_menu_items( $menu_items ) {
        $menu_items[ 'tinv_wishlist' ] = __( 'Wishlist', '' );
        return $menu_items;
    }
    add_filter( 'woocommerce_account_menu_items', 'tinv_woocommerce_account_menu_items' );
    function tinv_woocommerce_account_menu_endpoint( $url, $endpoint, $value, $permalink ) {
        if ( 'tinv_wishlist' === $endpoint && function_exists( 'tinv_url_wishlist_default' ) ) {
    	$url = tinv_url_wishlist_default();
        }
        return $url;
    }
    add_filter( 'woocommerce_get_endpoint_url', 'tinv_woocommerce_account_menu_endpoint', 4, 10 );
    Thread Starter Michael Shinosky

    (@michael-shinosky)

    Coolio! The placement is below the Logout button in my theme. Best if it was located somewhere above it.

    Plugin Author templateinvaders

    (@templateinvaders)

    Hi Michael,

    You can use updated snippet below to adjust the ‘Wishlist’ menu item position:

    function tinv_woocommerce_account_menu_items( $menu_items ) {
        $output = array_slice( $menu_items, 0, 1, TRUE ) + array( 'tinv_wishlist' => __( 'Wishlist', '' ) ) + array_slice( $menu_items, 1, NULL, TRUE );
        return $output;
    }
    
    add_filter( 'woocommerce_account_menu_items', 'tinv_woocommerce_account_menu_items' );
    
    function tinv_woocommerce_account_menu_endpoint( $url, $endpoint, $value, $permalink ) {
        if ( 'tinv_wishlist' === $endpoint && function_exists( 'tinv_url_wishlist_default' ) ) {
    	$url = tinv_url_wishlist_default();
        }
        return $url;
    }
    
    add_filter( 'woocommerce_get_endpoint_url', 'tinv_woocommerce_account_menu_endpoint', 4, 10 );

    Cheers.

    Thread Starter Michael Shinosky

    (@michael-shinosky)

    Perfecto!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add Wishlist To Account Page’ is closed to new replies.