Reserve Your Free Seat for Our Next WooCommerce Class! Search
Business Bloomer
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • 0
  • Business Bloomer Club
  • WooCommerce Plugins
  • WooCommerce Tips
  • Log In
  • Search
  • Contact
  • Cart
WooCommerce Code Snippets My Account

WooCommerce: Change Default My Account Tab

Last Revised: Aug 2022

STAY UPDATED

As you know, once you log in and go to My Account, WooCommerce displays the “Dashboard” tab content (also called the Dashboard “endpoint”). The Dashboard tab features the default “Hello Rodolfo Melogli (not Rodolfo Melogli? Log out) From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.” message.

Now, what if we want to set another My Account tab as the default one upon login, for example the “Orders” one, or the “Downloads” one for a digital downloads WooCommerce business? Well, there are a couple of quick and not-so-quick solutions, enjoy!

With Snippet 2 you find below, I was able to set the “Downloads” tab as the default one when a user lands on the My Account page. Also, the “Dashboard” tab is preserved, unlike the solution offered by Snippet 1.

PHP Snippet 1: Redirect Users to Another My Account Tab

By redirecting to another tab when people visit the “Dashboard” one, we’re simply saying that we wish to hide the whole Dashboard tab content. You will also need to remove the Dashboard tab from the My Account menu.

/**
 * @snippet       Redirect to new default tab @ WooCommerce My Account
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 6
 * @community     https://businessbloomer.com/club/
 */

add_action( 'template_redirect', 'bbloomer_my_account_redirect_to_downloads' );

function bbloomer_my_account_redirect_to_downloads(){
	if ( is_account_page() && empty( WC()->query->get_current_endpoint() ) ) {
		wp_safe_redirect( wc_get_account_endpoint_url( 'orders' ) );
		exit;
	}
}

In this case we’ve picked the “orders” tab. You can find other WooCommerce My Account tab IDs by looking at this other post.

PHP Snippet 2: Set Another My Account Tab as Default (But Keep The Dashboard)

You may not want to hide the Dashboard tab at all, and simply set another as the default tab. In this case, we can’t use the redirect snippet, as otherwise the Dashboard will never show.

Unfortunately, as of today, there is no clean solution (even if you reorder My Account tabs, the Dashboard tab content will show on load) – we need to find a workaround.

This workaround:

  1. replaces the “Dashboard” tab content to the tab content of your choice (e.g. “Downloads” tab content)
  2. renames the “Dashboard” tab title to whatever you want (“Downloads” in our example)
  3. hides the original “Downloads” tab as we already have it now
  4. readds the “Dashboard” tab as first tab together with its content

Part 1 – Replace Dashboard tab content with Downloads tab content

Please note woocommerce_account_downloads() is the function responsible to output the Downloads tab. You can find the other tabs’ content in this other tutorial.

/**
 * @snippet       Replace tab content @ WooCommerce My Account
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 6
 * @community     https://businessbloomer.com/club/
 */

add_action( 'woocommerce_account_content', 'bbloomer_myaccount_replace_dashboard_content', 1 );

function bbloomer_myaccount_replace_dashboard_content() {
	remove_action( 'woocommerce_account_content', 'woocommerce_account_content', 10 );
	add_action( 'woocommerce_account_content', 'bbloomer_account_content' );
}

function bbloomer_account_content() {
	global $wp;
	if ( empty( $query_vars = $wp->query_vars ) || ( ! empty( $query_vars ) && ! empty( $query_vars['pagename'] ) ) ) {
		woocommerce_account_downloads();
	} else {
		foreach ( $wp->query_vars as $key => $value ) {
			if ( 'pagename' === $key ) {
				continue;
			}
			if ( has_action( 'woocommerce_account_' . $key . '_endpoint' ) ) {
				do_action( 'woocommerce_account_' . $key . '_endpoint', $value );
				return;
			}
		}
	}
}

Part 2 – Rename Dashboard tab title to Downloads

/**
 * @snippet       Rename tab @ WooCommerce My Account
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 6
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'woocommerce_account_menu_items', 'bbloomer_myaccount_rename_dashboard_tab_title', 9999 );
 
function bbloomer_myaccount_rename_dashboard_tab_title( $items ) {
   $items['dashboard'] = 'Downloads';
   return $items;
}

Part 3 – Remove original Downloads tab

/**
 * @snippet       Remove tab @ WooCommerce My Account
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 6
 * @community     https://businessbloomer.com/club/
 */

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

Part 4 – Readd Dashboard tab

Note: you must resave the WordPress permalinks once the snippet is active.

/**
 * @snippet       Readd Dashboard tab @ WooCommerce My Account
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 6
 * @community     https://businessbloomer.com/club/
 */

add_action( 'init', 'bbloomer_myaccount_add_dashboard_endpoint' );
  
function bbloomer_myaccount_add_dashboard_endpoint() {
    add_rewrite_endpoint( 'mydashboard', EP_ROOT | EP_PAGES );
}

add_filter( 'query_vars', 'bbloomer_query_vars', 0 );
  
function bbloomer_query_vars( $vars ) {
    $vars[] = 'mydashboard';
    return $vars;
}
  
add_filter( 'woocommerce_account_menu_items', 'bbloomer_add_new_dashboard_to_my_account' );
  
function bbloomer_add_new_dashboard_to_my_account( $items ) {
	$items = array( 'mydashboard' => 'Dashboard' ) + $items;
    return $items;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Separate Login, Registration, My Account Pages
    There are times when you need to send logged out customers to a Login page and unregistered customers to a standalone Register page. As you…
  • WooCommerce: Add New Tab @ My Account Page
    One of the features of Business Bloomer Club is the provision of Premium WooCommerce Q&A Support to supporters who enroll. So, how to add an…
  • WooCommerce: How To Make A Website GDPR Compliant? (12 Steps)
    Ok, we all know that the EU General Data Protection Regulation (GDPR) will come into force on the 25th May 2018. So the main question…
  • WooCommerce Visual Hook Guide: My Account Pages
    Hey WooCustomizers, the Visual Hook Guide is back 🙂 In this episode, I’ve created a visual HTML hook guide for the WooCommerce Account Pages (there…
  • WooCommerce: Add First & Last Name to My Account Register Form
    Here’s yet another useful PHP snippet – and a mini-plugin alternative with super simple settings – that adds the Billing First Name and Billing Last…

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

2 thoughts on “WooCommerce: Change Default My Account Tab”

  1. Débs
    November 15, 2024

    Thanks for your content, very helpful. By any chance, do you know what is the hook to remove the default welcome message that appears in the Dashboard tab of My Account? Thank you

    Reply
    1. Rodolfo Melogli
      November 19, 2024

      Great! If you mean the “From your account dashboard you can view your…” message, there is no filter hook available – but you can always reword it: https://www.businessbloomer.com/translate-single-string-woocommerce-wordpress/

      Reply
Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Cancel reply

Your email address will not be published. Required fields are marked *


Search WooCommerce Tips

Popular Searches: Visual Hook Guides - Checkout Page - Cart Page - Single Product Page - Add to Cart - Emails - Shipping - Prices - Hosting

Recent Articles

  • WooCommerce: How to Configure Product and Order Sync
  • WooCommerce: “Beautify” Item Meta in Order Emails
  • WooCommerce: Per-Product Checkout Fees / Tariffs
  • WooCommerce: Auto-Cancel Orders After 3 Failed Payments
  • WooCommerce: Bulk Delete Pending / Failed Scheduled Actions

Latest Comments

  1. Rodolfo Melogli on WooCommerce: Remove “Payments” From WordPress Sidebar Admin Menu
  2. Rodolfo Melogli on WooCommerce: Remove “Payments” From WordPress Sidebar Admin Menu
  3. Rodolfo Melogli on WooCommerce: Remove “Payments” From WordPress Sidebar Admin Menu

Find Out More

  • Become a WooCommerce Expert
  • Business Bloomer Club
  • WooCommerce Blog
  • WooCommerce Weekly
  • Contact

Contact Info

Ciao! I'm Rodolfo Melogli, an Italian Civil Engineer who has turned into an international WooCommerce expert. You can contact me here:

Twitter: @rmelogli

Get in touch: Contact Page

Business Bloomer © 2011-2025 - VAT IT02722220817 - Terms of Use - Privacy Policy

Cart reminder?

x