Business Bloomer
  • About
  • WooCommerce Blog
  • Online Courses
  • Login
  • 0
  • About
  • WooCommerce Blog
  • Online Courses
  • Login
  • 0

WooCommerce: Horizontal My Account Navigation Menu

> Published: Mar 2021
> Blog Category: WooCommerce Tips
> Blog Tags: My Account, Storefront Theme
> Blog Comments: 11 Comments
Tweet

Join 17,000+ WooWeekly subscribers

The WooCommerce My Account pages feature a “left sidebar” navigation menu (by default, links are: “Dashboard”, “Orders”, “Downloads”, “Addresses”, “Account details”, “Logout”).

A cool (and easy) improvement may be moving such navigation to the top, and displaying it horizontally instead of vertically. You’d think this is a complex PHP customization… but you’ll feel great when you’ll notice you just need CSS for that.

Please note the CSS may change slightly based on your theme, in case it applies custom CSS to the default WooCommerce My Account navigation panel. I will list below a couple of solutions for default WooCommerce and for the Storefront theme, so at least you have an idea of what you could need in terms of tweaking it. Enjoy!

Here’s the default WooCommerce My Account pages navigation menu layout. If you don’t like sidebars this is the right tutorial for you!

CSS Snippet (Default WooCommerce): Display My Account Navigation Menu Horizontally As Opposed to Vertically

First thing, we want to stretch the My Account navigation and the My Account tab content onto a full width on big devices (by default, WooCommerce already applies such rule for devices up to 768px):

@media only screen and (min-width: 769px) {
   .woocommerce-account .woocommerce-MyAccount-content, .woocommerce-account .woocommerce-MyAccount-navigation {
       float: none;
       width: 100%;
   }
}

Here’s the result:

Second, we need to center align the navigation menu (UL tag) and make its items move horizontally (LI tags):

@media only screen and (min-width: 769px) {
   .woocommerce-MyAccount-navigation ul {
       text-align: center;
   }
   .woocommerce-MyAccount-navigation ul li {
       display: inline-block;
   }
}

CSS code, all together, so you can copy/paste:

@media only screen and (min-width: 769px) {

   .woocommerce-account .woocommerce-MyAccount-content, .woocommerce-account .woocommerce-MyAccount-navigation {
       float: none;
       width: 100%;
   }

   .woocommerce-MyAccount-navigation ul {
       text-align: center;
   }

   .woocommerce-MyAccount-navigation ul li {
       display: inline-block;
   }

}

CSS Snippet (Storefront Theme): Display My Account Navigation Menu Horizontally As Opposed to Vertically

@media (min-width: 768px) {

   .page-template-template-fullwidth-php .woocommerce-MyAccount-navigation, .page-template-template-fullwidth-php .woocommerce-MyAccount-content {
      width: 100%;
      float: none;
   }

   .woocommerce-MyAccount-navigation ul {
      text-align: center;
      border-bottom: 1px solid rgba(0,0,0,.05);
   }

   .woocommerce-MyAccount-navigation ul li {
      display: inline-block;
      border-left: 1px solid rgba(0,0,0,.05);
      padding: 0 1em;
      border-bottom: 0;
   }

}

Is There a (Reliable) Plugin For That?

If you’d love to code but don’t feel 100% confident with CSS, 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 changing the navigation menu layout, you can also customize the color scheme, add banners, set up reCaptcha on the register and login forms, add, sort, rename, delete and group 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 ๐Ÿ™‚

Related posts:

  1. WooCommerce: Add New Tab @ My Account Page
  2. Storefront Theme: How to Customize Homepage Layout
  3. WooCommerce: Hide or Rename a My Account Tab
  4. WooCommerce: How to Merge My Account Tabs
  5. WooCommerce + Jetpack: Exclude Image From “Lazy Load”
  6. WooCommerce + Storefront Theme: Hide Homepage Title
  7. WooCommerce: Separate Login, Registration, My Account Pages
  8. WooCommerce: Rename “My Account” If Logged Out @ Nav Menu
  9. WooCommerce: Login Redirect to Previous URL @ My Account
  10. Storefront Theme: Edit or Remove Footer Credits

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

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
Category: WooCommerce Tips
Tags: My Account, Storefront Theme

Post navigation

Previous post: WooCommerce: “Explode” Product Tabs
Next post: WooCommerce: 5 Must-Knows to Develop a Payment Gateway From an API

11 thoughts on “WooCommerce: Horizontal My Account Navigation Menu”

  1. Criss
    May 5, 2021

    I believe you must get rid of the float:none; in the very first part of the code, because it causes some of the content to overlap the menu. I don’t know the reason why, it just does.

    Reply
    1. Rodolfo Melogli
      May 7, 2021

      Thanks!

      Reply
  2. Ruchi
    March 22, 2021

    Hey Rodolfo,

    I have recently started reading your posts and have learnt a lot. I have been trying to horizontally align the menu on WordPress 5.7 with your snippet . The first desk-lay gets centre aligned but when u click on any of the menu item it goes back to being displayed vertically.In effect it is not working.

    Tx

    Reply
    1. Rodolfo Melogli
      March 22, 2021

      No idea, sorry!

      Reply
      1. an
        March 26, 2021

        Probably browser cache issue, means the css you changed is not applyed but loaded from cache.

        1. Try to clean cache
        2. Try to add this css code from Customizer
        3. May be because of wrong css classes in your theme (this will works only in standard woo commerce template structure)

        I hope it helps

        Reply
  3. Tor Ivan Boine
    March 17, 2021

    Works great. Thanks ๐Ÿ™‚

    Reply
    1. Rodolfo Melogli
      March 22, 2021

      Cheers

      Reply
  4. Razvan
    March 17, 2021

    Thanks for this trick!

    Reply
    1. Rodolfo Melogli
      March 22, 2021

      Glad you enjoyed it!

      Reply
  5. Johan Linder
    March 17, 2021

    Great tip, thanks. I added 40 px padding-right because I got the menu items too close to each other. Maybe Divi-related?

    Reply
    1. Rodolfo Melogli
      March 22, 2021

      Yeah, could be. Great!

      Reply
Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. 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 BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Cancel reply

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

Recent Posts
  • WooCommerce: Bulk Re-Send All Customer’s Completed Order Emails
  • WooCommerce: Upsells Custom Heading & Subheading @ Single Product Page
  • WooCommerce: Redirect Product Category Pages
  • WooCommerce: Close Button @ WooCommerce Checkout Notices
  • WooCommerce: Related Products Custom Heading & Subheading
About Business Bloomer

With 100,000 (and growing) monthly organic sessions, Business Bloomer is the most consistent, most active and most complete WooCommerce development/customization blog.

Of course this website itself uses the WooCommerce plugin, the Storefront theme and runs on a WooCommerce-friendly hosting.

Join 75,000+ Monthly Readers & 16,500+ Subscribers.

Become a Business Bloomer Supporter.

Join BloomerArmada and become an Official Business Bloomer Supporter:
easy-peasy, and lots of perks for you.
See your Benefits →
Popular Searches: Visual Hook Guides - Checkout Page - Cart Page - Single Product Page - Add to Cart - Emails - Shipping - Prices - Hosting
Latest Articles
  • WooCommerce: Bulk Re-Send All Customer’s Completed Order Emails
  • WooCommerce: Upsells Custom Heading & Subheading @ Single Product Page
  • WooCommerce: Redirect Product Category Pages
  • WooCommerce: Close Button @ WooCommerce Checkout Notices
  • WooCommerce: Related Products Custom Heading & Subheading
Latest Comments
  • Rodolfo Melogli on WooCommerce: How to Bulk Generate Coupons Without a Plugin
  • Rodolfo Melogli on WooCommerce: Change “Return to Shop” URL
  • Rodolfo Melogli on WooCommerce: Move & Customize Upsells @ Single Product
  • Rodolfo Melogli on WooCommerce: Display Custom Product Badge (Conditionally)
Find Out More
  • Become a WooCommerce Expert
  • WooCommerce Blog
  • WooCommerce Online Courses
  • WooCommerce Weekly
  • Bloomer Armada
  • Affiliate Program
  • 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:

Email: [email protected]

Twitter: @rmelogli

Hire me by the hour: Get Quote ยป

VisaMastercardAmexPayPal Acceptance Mark
Business Bloomer © 2011-2023 - Terms of Use - Privacy Policy