Home » WooCommerce: How to Merge My Account Tabs

WooCommerce: How to Merge My Account Tabs

by Tutorials Info

The default WooCommerce My Account tabs are many. Sometimes, they’re too many. In this post, we will see how to “merge” two tabs into a single one.

For example, how can we move the content of the “Edit Address” tab into the “Edit Account” tab – and save users some navigation time?

WooCommerce: merge two “My Account” tabs

PHP Snippet: Merge Two My Account Tabs @ WooCommerce My Account Page

Merging two tabs means hiding a tab, and after that moving its content to another tab. Super easy, and you can apply this to any tab, as long as you change the snippet below with the correct name of the tabs (or endpoints, like WooCommerce calls them).

/**
* @snippet       Merge Two "My Account" Tabs @ WooCommerce Account
* @how-to        Get tutoraspire.com FREE
* @author        Tutor Aspire
* @compatible    WooCommerce 5.0
* @donate $9     https://www.tutoraspire.com
*/

// -------------------------------
// 1. First, hide the tab that needs to be merged/moved (edit-address in this case)

add_filter( 'woocommerce_account_menu_items', 'tutoraspire_remove_address_my_account', 999 );

function tutoraspire_remove_address_my_account( $items ) {
   unset( $items['edit-address'] );
   return $items;
}

// -------------------------------
// 2. Second, print the ex tab content (woocommerce_account_edit_address) into an existing tab (woocommerce_account_edit-account_endpoint). See notes below!

add_action( 'woocommerce_account_edit-account_endpoint', 'woocommerce_account_edit_address' );

// NOTES
// 1. to select a given tab, use 'woocommerce_account_ENDPOINTSLUG_endpoint' hook
// 2. to print a given tab content, use any of these:
// 'woocommerce_account_orders'
// 'woocommerce_account_view_order'
// 'woocommerce_account_downloads'
// 'woocommerce_account_edit_address'
// 'woocommerce_account_payment_methods'
// 'woocommerce_account_add_payment_method'
// 'woocommerce_account_edit_account'

Is There a (Reliable) Plugin For That?

If you’d love to code but don’t feel 100% confident with PHP, I decided to look for a reliable plugin that achieves the same result.

In this case, I recommend the YITH WooCommerce Customize My Account Page plugin. On top of merging My Account tabs, you can also move the tab menu around, customize the color scheme, add banners, set up reCaptcha on the register and login forms, sort, rename, delete tabs, conditionally show tabs to a given user role and much more.

But in case you hate plugins and wish to code (or wish to try that), then keep reading 🙂

You may also like