In this tutorial we will learn how we can the menu order in Woocoomerce. This is not a difficult task to do just need to enter couple of lines in your theme’s function file. By default menu in my account page of woocommerce looks like this :
For changing the menu just look at the code below:
/**
* Edit my account menu order
*/
function labo_account_menu_order() {
$menuOrder = array(
'dashboard' => __( 'Dashboard', 'woocommerce' ),
'orders' => __( 'Orders', 'woocommerce' ),
'downloads' => __( 'Download', 'woocommerce' ),
'edit-address' => __( 'Addresses', 'woocommerce' ),
'edit-account' => __( 'Account Details', 'woocommerce' ),
'customer-logout' => __( 'Logout', 'woocommerce' ),
);
return $menuOrder;
}
add_filter ( 'woocommerce_account_menu_items', 'labo_account_menu_order' );
For changing the menu items you just need to move the items in $menuOrder array like this changing the “Account Details” option just under dashboard:
function labo_account_menu_order() {
$menuOrder = array(
'dashboard' => __( 'Dashboard', 'woocommerce' ),
'edit-account' => __( 'Account Details', 'woocommerce' ),
'orders' => __( 'Orders', 'woocommerce' ),
'downloads' => __( 'Download', 'woocommerce' ),
'edit-address' => __( 'Addresses', 'woocommerce' ),
'customer-logout' => __( 'Logout', 'woocommerce' ),
);
return $menuOrder;
}
add_filter ( 'woocommerce_account_menu_items', 'labo_account_menu_order' );
After saving the functions file you will end up with your desired result like this :
More related to woo-commerce customization :
Custom redirect on clicking add to cart