woocommerce add menu to my account

Solutions on MaxInterview for woocommerce add menu to my account by the best coders in the world

showing results for - "woocommerce add menu to my account"
María Alejandra
16 Sep 2020
1add_filter ( 'woocommerce_account_menu_items', 'misha_one_more_link' );
2function misha_one_more_link( $menu_links ){
3 
4	// we will hook "anyuniquetext123" later
5	$new = array( 'anyuniquetext123' => 'Gift for you' );
6 
7	// or in case you need 2 links
8	// $new = array( 'link1' => 'Link 1', 'link2' => 'Link 2' );
9 
10	// array_slice() is good when you want to add an element between the other ones
11	$menu_links = array_slice( $menu_links, 0, 1, true ) 
12	+ $new 
13	+ array_slice( $menu_links, 1, NULL, true );
14 
15 
16	return $menu_links;
17 
18 
19}
20 
21add_filter( 'woocommerce_get_endpoint_url', 'misha_hook_endpoint', 10, 4 );
22function misha_hook_endpoint( $url, $endpoint, $value, $permalink ){
23 
24	if( $endpoint === 'anyuniquetext123' ) {
25 
26		// ok, here is the place for your custom URL, it could be external
27		$url = site_url();
28 
29	}
30	return $url;
31 
32}