woocommerce_account_menu_itemsfilter-hookWC 1.0

Allows you to add/remove menu items in My Account.

Usage

add_filter( 'woocommerce_account_menu_items', 'wp_kama_woocommerce_account_menu_items_filter', 10, 2 );

/**
 * Function for `woocommerce_account_menu_items` filter-hook.
 * 
 * @param  $items     
 * @param  $endpoints 
 *
 * @return 
 */
function wp_kama_woocommerce_account_menu_items_filter( $items, $endpoints ){
	// filter...
	return $items;
}
$items(array)
An associative array of registered menu items.
$endpoints(array)
An associative array of registered endpoints for menu items.

Examples

#1 Remove the “Downloads” menu item

add_filter( 'woocommerce_account_menu_items', 'remove_downloads_link' );

function remove_downloads_link( $items ) {
	if ( isset( $items['downloads'] ) ) {
		unset( $items['downloads'] );
	}

	return $items;
}

#2 Add a new “Wish list” menu item with an endpoint and content output

// Add the “Wish list” menu item
add_filter( 'woocommerce_account_menu_items', 'add_wish_list_item' );
function add_wish_list_item( $items ) {

	$items['wish-list'] = __( 'Wish list' );

	return $items;
}

// Add the endpoint
// Refresh the permalinks after adding the endpoint!
add_action( 'init', 'add_wish_list_endpoint' );
function add_wish_list_endpoint() {
	add_rewrite_endpoint( 'wish-list', EP_PAGES );
}

// Output the page content
add_action( 'woocommerce_account_wish-list_endpoint', 'show_wish_list' );
function show_wish_list() {
	echo 'Hello world';
}

Where the hook is called

wc_get_account_menu_items()
woocommerce_account_menu_items
woocommerce/includes/wc-account-functions.php 138
return apply_filters( 'woocommerce_account_menu_items', $items, $endpoints );

Where the hook is used in WooCommerce

woocommerce/src/Internal/ShopperLists/ShopperListsController.php 100
add_filter( 'woocommerce_account_menu_items', array( $this, 'add_wishlist_menu_item' ) );