This article explains how to redorder the menu items in /my-account page. The default ordering looks like this.

My Account

Here is a code to override the menu ordering and WooCommerce my-account page.

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

/**
 * Sort Order.
 *
 * @var Array
 */
public static $sort_order = array(
	'dashboard'       => 0,
	'edit-account'    => 1,
	'orders'          => 2,
	'points'          => 3,
	'edit-address'    => 4,
	'payment-methods' => 5,
	'customer-logout' => 6,
	'downloads'       => 7,
);

/**
 * Rearrange Wc Account Menu Items
 *
 * @param array  $items Items.
 * @param string $endpoints Endpoints.
 */
public function rearrange_wc_account_menu_items( $items, $endpoints ) {
	uksort(
		$items,
		function( $a, $b ) {
			$order_a = isset( $this::$sort_order[ $a ] ) ? $this::$sort_order[ $a ] : 99;
			$order_b = isset( $this::$sort_order[ $b ] ) ? $this::$sort_order[ $b ] : 99;
			if ( $order_a > $order_b ) {
				return 1;
			}
			if ( $order_b > $order_a ) {
				return -1;
			}
			return 0;
		}
	);
	return $items;
}

Explanation

We are filtering the menu list via the woocommerce_account_menu_items hook. First, we define the ordering we want in an array, and then we use the uksort() function to reorder it.

You can also change the menu text

In addition, you can also use this hook to override the menu text from WooCommerce.

In below code, we are changing the default menu name ‘Downloads’ to ‘My Downloads’.

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

/**
 * Rearrange Wc Account Menu Items
 *
 * @param array  $items Items.
 * @param string $endpoints Endpoints.
 */
public function change_item_name( $items, $endpoints ) {
	$items['downloads'] = __( 'My Downloads' , 'my-text-domain' );
	return $items;
}