Home WordPressWooCommerce Woocommerce : change menu order in Woo commerce

Woocommerce : change menu order in Woo commerce

by admin
0 comment 195 views

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 :

default woocommerce menu listing in woocommerce

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 :

changed menu order

 

More related to woo-commerce customization :

Custom redirect on clicking add to cart

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy