/* Register New Menu in WooCommerce my-account Page */
function wpflt_woo_new_menu_item_one_my_account( $menu_links ){
$new = array( 'support-tickets' => 'Support Tickets' );
$menu_links = array_slice( $menu_links, 0, 1, true )
+ $new
+ array_slice( $menu_links, 1, NULL, true );
return $menu_links;
}
add_filter ( 'woocommerce_account_menu_items', 'wpflt_woo_new_menu_item_one_my_account' );
function wpflt_woo_new_menu_item_url( $url, $endpoint, $value, $permalink ){
if( $endpoint === 'support-tickets' ) {
$url = "https://support.example.com";
}
return $url;
}
add_filter( 'woocommerce_get_endpoint_url', 'wpflt_woo_new_menu_item_url', 10, 4 );
If you want to create a new menu item in WooCommerce my-account page, add the above code to your child theme’s functions.php.
In the above code, we are adding a new menu item ‘Support Tickets’ (in line 3). The referring URL for that menu item is https://support.example.com (mentioned in line 12)