Advertisement - contains affiliate link

If you are creating a WooCommerce-powered WordPress webshop, you might get into the following situation. Per default, the WooCommerce “My Account” section displays the following menu entries for the user. I want to show you how to adapt WooCommerce Customer Menu

Advertisement - contains affiliate link
  • Dashboard
  • Orders
  • Downloads
  • Addresses
  • Account Details
  • Logout

For our modifications we just need to edit the functions.php file of your child theme. For my webshop, I wanted to rename two menu entries and hide one completely.

Remove Account Menu Item

Basically, the code to modify the menu items is very simple. Here, I just added a filter to remove the “Downloads” tab because I had nothing to download in this shop. The function itself simply unsets the specified item and returns the other items.

add_filter( 'woocommerce_account_menu_items', 'remove_downloads_my_account', 999 );
function remove_downloads_my_account( $items ) {
unset($items['downloads']);
return $items;
}

Rename Account Menu Item

Another requirement was to rename the tabs “Edit Address” and “Edit Account” because the German translations were not the best to say it like that 🙂 Again we are adding a filter for the needed menu entry, add a function and simply edit the text of the item before returning it.

add_filter( 'woocommerce_account_menu_items', 'rename_address_my_account', 999 );
function rename_address_my_account( $items ) {
$items['edit-address'] = '<Insert your custom text here>';
return $items;
}

add_filter( 'woocommerce_account_menu_items', 'rename_edit_my_account', 999 );
function rename_edit_my_account( $items ) {
$items['edit-account'] = '<Insert your custom text here>';
return $items;
}

I found the necessary information at the following site, thank you very much!:
https://businessbloomer.com/
Adapt WooCommerce Customer Menu

If you want to optimize your WooCommerce-powered store with a caching plugin, I recommend you to read the following article

Advertisement - contains affiliate link

LEAVE A REPLY

Please enter your comment!
Please enter your name here