add new tab to my account in woocommerce

i wanted to add wishlist tab to the account page in woocommerce in the the theme enfold  i was using the yith plugin yith-woocommerce-wishlist  so i need to show the title with link to the content that will show the shortcode here what i did

first add to function.php in the child theme this code

* add option to edit elements via css class
// add_theme_support('avia_template_builder_custom_css');

* Insert the new endpoint into the My Account menu.
* @param array $items
* @return array
function my_custom_my_account_menu_items( $items ) {
// Remove the logout menu item.
$logout = $items['customer-logout'];
unset( $items['customer-logout'] );

// Insert your custom endpoint.
$items['my-custom-endpoint'] = __( 'המעודפים שלי', 'woocommerce' );

// Insert back the logout item.
$items['customer-logout'] = $logout;

return $items;

add_filter( 'woocommerce_account_menu_items', 'my_custom_my_account_menu_items' );

* Register new endpoint to use inside My Account page.
* @see
function my_custom_endpoints() {
add_rewrite_endpoint( 'my-custom-endpoint', EP_ROOT | EP_PAGES );

add_action( 'init', 'my_custom_endpoints' );

* Add new query var.
* @param array $vars
* @return array
function my_custom_query_vars( $vars ) {
$vars[] = 'my-custom-endpoint';

return $vars;

add_filter( 'query_vars', 'my_custom_query_vars', 0 );

* Endpoint HTML content.
function my_custom_endpoint_content() {
echo do_shortcode('[yith_wcwl_wishlist]');

add_action( 'woocommerce_account_my-custom-endpoint_endpoint', 'my_custom_endpoint_content' );


so with the function my_custom_endpoint_content i can display what i want in the my account tab content and i did used the shortcode that comes with the plugin


6 thoughts on “add new tab to my account in woocommerce

  1. gospina1717 says:

    Hey, I did this as well, but I noticed that the other links (create, manage, and search) don’t work when I used this method.

  2. avtmbijouterienomade says:

    Hey there ! I wanted to do exactly the same (add a tab with “my whishlist” from yith wishlist plugin). I copied/paste your code in my php file but it does not work ! Is it still working on your website ? Maybe because of the new update of woocommerce (I have version 5.0.2). Thanks !

Leave a Reply :)

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s