How to Merge Learndash and Woocommerce Account Pages?

By default, your Learndash and Woocommerce have their own account pages and for the end user that can be a bit of cumbersome experience. Therefore, in this tutorial I’m going to show you how to merge Learndash and Woocommerce account pages in a way that all your important data (courses, orders, account details etc.) can be accessed from one place.

Kadence theme


This is what the end result will look like.

How to Merge Learndash and Woocommerce Account Pages?

Video: How to Merge Learndash and Woocommerce Account Pages?

How to Merge Learndash and Woocommerce Account Pages?

Here are the steps you need to take in order to merge Learndash and Woocommerce account pages.

Step 1: Install Code Snippets plugin

Code Snippets plugin is a free plugin which allows your to run PHP/HTML/CSS/JavaScript code snippets on your site without the need to modify functions.php. The plugin can be found here. In this tutorial we are going to use this plugin to add some code snippets.

Another option, paste the code snippets shown below to your child theme’s functions.php file.

Step 2: Add “Courses” endpoint to Woocommerce

Since we need a new endpoint to be shown on the Woocommerce account page, we need to create a new endpoint. So, create a new snippet in Code Snippets and (Snippets >> Add new) paste this code to the code box. Read the explanations inside the snippets.

With the help of this snippet here below I’ll add the Courses endpoint and Courses page to the Woocommerce account page. I want to show all the user courses on the Woocommerce Courses page I‘ going to use the profile shortcode [ld_profile] inside the snippet.

// Add new tab to My Account menu

add_filter ( 'woocommerce_account_menu_items', 'wpsh_custom_endpoint', 40 );
function wpsh_custom_endpoint( $menu_links ){
	$menu_links = array_slice( $menu_links, 0, 5, true ) 
		// Add your own slug (support, for example) and tab title here below
	+ array( 'my-courses' => 'My courses' ) 
	+ array_slice( $menu_links, 5, NULL, true );
	return $menu_links;
// Let’s register this new endpoint permalink

add_action( 'init', 'wpsh_new_endpoint' );
function wpsh_new_endpoint() {
	add_rewrite_endpoint( 'my-courses', EP_PAGES ); // Don’t forget to change the slug here

// Now let’s add some content inside your endpoint

add_action( 'woocommerce_account_my-courses_endpoint', 'wpsh_endpoint_content' ); // If you change your slug above then don’t foget to chagne it alse inside this function
function wpsh_endpoint_content() {
	// At the moment I will add Learndash profile with the shordcode
	echo (
		'<h3>Here are your courses</h3>
	<p>Lorem ipsum dolor sit amet consectetur adipiscing elit facilisis tincidunt, nisi sociosqu lacinia auctor inceptos libero conubia accumsan</p>'
	echo do_shortcode('[ld_profile]');

// NB! In order to make it work you need to go to Settings > Permalinks and just push "Save Changes" button.

Step 3: Change the Woocommerce endpoint order (optional)

Currently the new Courses endpoint is the last one before logout but I want to change the position of this endpoint. Therefore, I‘m going to add this snippet to the Code Snippets. You and customize the order as you find suitable for your site.

// Change Woocommerce endpoint order

add_filter ( 'woocommerce_account_menu_items', 'wpsh_custom_endpoint_order' );
function wpsh_custom_endpoint_order() {
 $myorder = array(
        'dashboard'          => __( 'Dashboard', 'woocommerce' ),
	 	 'my-courses'    => __( 'My courses', 'woocommerce' ), // Don’t forget to change the slug and title here
        'orders'             => __( 'Your orders', 'woocommerce' ), 
        'edit-account'       => __( 'Account details', 'woocommerce' ),
	 	'edit-address'       => __( 'Edit address', 'woocommerce' ),
	 	'woo-wish-list'       => __( 'Wishlist', 'woocommerce' ),
        'customer-logout'    => __( 'Log out', 'woocommerce' ),
    return $myorder;

Step 4: Redirect user to the Learndash Courses tab after login

I have a modal login on my site header and if someone is logging in he/she will stay on the same page he/she was before login. I want the user to be redirected to My account >> Courses endpoint. And I don’t want this redirection to happen to the administrator or author roles.

So, I’ll add this snippet to the Code snippets. Pay attention thou

function woo_login_redirect( $url, $request, $user ){
if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if( $user->has_cap( 'administrator') or $user->has_cap( 'author')) {
$url = admin_url();
} else {
$url = home_url('/my-account/my-courses/'); // HERE GOES THE REDIRECTION URL
return $url;
add_filter('login_redirect', 'woo_login_redirect', 10, 3 );

If previous redirection is not working on your site then try to add this piece of code here below. There are some additional options for you to redirect your user.

add_filter( 'woocommerce_login_redirect', 'learndash_login_redirect', 9999, 2 );
function learndash_login_redirect( $redirect, $user ) {
    if ( wc_user_has_role( $user, 'customer' ) ) {
       // $redirect = get_home_url(); // homepage
       // $redirect = wc_get_page_permalink( 'shop' ); // shop page
       $redirect = '/my-account/my-courses/'; // custom URL same site
        //$redirect = 'https://custom.url'; // custom URL other site
        //$redirect = add_query_arg( 'password-reset', 'true', wc_get_page_permalink( 'myaccount' ) ); // custom My Account tab
    return $redirect;

Step 5: Redirect Learndash Edit profile link to Woocommere Edit account link

At this point we already have successfully merged Learndash and Woocommerce account pages but there are some other things to consider. For example, there is a Edit profile link under the Leardash profile avatar and clicking on that link opens up WordPress backend profile.

I don’t like it at all and since I want the user to stay on the My account page and edit his/her account there, I will add this snippet to the Code snippets.

add_filter( 'get_edit_user_link', function( $link, $user_id ) {
	$link = "/my-account/edit-account/"; // HERE GOES THE EDIT ACCOUNT ENDPOINT URL
	return $link;
}, 30, 2 );

Step 6: Create a new nice looking My account dashboard

I have written a full tutorial how to customize you Woocommerce account page with customizer. Or with Elementor. Take a look at this post here.

The end result will be something like that. You just need to add Courses link and customize the look to your needs.

How To Customize WooCommerce My Account Page with Gutenberg?

Step 7: Remove old Woocommerce my account dashboard navigation

So, you have created a new dashboard but the old navigation links are still there on the sidebar? Well, in order to customize your Woocommerce my account dashboard there is one more thing you need to do. And that means removing this navigation.

Therefore, go to Appearance >> Customizer >> Additional CSS and add this bit of a CSS code.

.woocommerce-MyAccount-navigation {
.woocommerce-account .woocommerce-MyAccount-content {
    width: 100%;

This bit of a code will remove the old navigation links and set the content to be shown in 100% width.

Bonus Tips on How to Merge Learndash and Woocommerce Account Pages

Below are two additional bonus tips on how to merge Learndash and Woocommerce account pages. This will make your users end experience a bit better.

Bonus tip 1: Disable Woocommerce logout confirmation

By default, Woocommerce won’t log you right out but instead it asks the confirmation whether you really want to do it. I find this annoying and therefore I usually disable it with this small piece of code here below. Add it to the Code snippets and you’re good to go.

function bypass_woo_logout_confirmation() {
    global $wp;
    if ( isset( $wp->query_vars['customer-logout'] ) ) {
        wp_redirect( str_replace( '&amp;', '&', wp_logout_url( wc_get_page_permalink( 'myaccount' ) ) ) );
add_action( 'template_redirect', 'bypass_woo_logout_confirmation' );

Bonus tip 2: Redirect user to the front page after logout

If you won’t use this code here below, your users will be redirected to the My account page. If you want them to be redirected to the front page instead, then add this code to the Code snippets.

function logout_redirect(){
    wp_redirect( home_url() );

Useful Tips

Here are some of my favorite WordPress tools

Thanks for reading this article! I hope it's been useful as you work on your own websites and e-commerce sites. I wanted to share some tools I use as a WordPress developer, and I think you'll find them helpful too.

Just so you know, these are affiliate links. If you decide to use any of them, I'll earn a commission. This helps me create tutorials and YouTube videos. But honestly, I genuinely use and recommend these tools to my friends and family as well. Your support keeps me creating content that benefits everyone.

Themes: Over the past few years, I've consistently relied on two primary themes for all sorts of projects: the Blocksy theme and the Kadence Theme. If you explore this website and my YouTube channel, you'll come across numerous tutorials that delve into these themes. If you're interested in obtaining a 10% discount for both of these themes, then:

Code Snippets Manager: WPCodeBox allows you to add code snippets to your site. Not only that, but it also provides you with the capability to construct and oversee your WordPress Code Snippets library right in the cloud. You can grab it with the 20% discount here (SAVE 20% Coupon: WPSH20).

Contact forms: There are hundreds of contact forms out there but Fluent Forms is the one I like the most. If you need a 20% discount then use this link (save 20% coupon is WPSH20).

Gutenberg add-ons: If I need a good Gutenberg blocks add-on then Kadence Blocks is the one I have used the most. You’ll get a 10% discount with the coupon SIMPLEHACKS here.

Website migration: While building a website you probably need a good plugin that can help you with the migration, backups, restoration, and staging sites. Well, WpVivid is the one I have used for the last couple of years. If you use this link along with the WPSH20 coupon you’ll get a 20% discount.

Woocommerce extensions: There are a bunch of Woocommerce extensions that I really like but the one that stands really out is Advanced Dynamic Pricing. Once again, you’ll get a 20% discount if you use this link here (save 20% coupon is WPSH20)

Web Hosting: If you would like to have a really fast and easy-to-use managed cloud hosting, then I recommend Verpex Hosting (see my review here). Btw, this site is hosted in Verpex.)

To see all my most up-to-date recommendations, check out this resource that I made for you!

Do you want to thank me and buy me a beer?

Every donation is entirely welcome but NEVER required. Enjoy my work for free but if you would like to thank me and buy me a beer or two then you can use this form here below.

Donation Form (#2)

Best selling plugins

Janek T.
Janek T.

I am a Wordpress enthusiast who has been making websites since 2011. In this site I am offering simple to follow tips on how to use Wordpress and Woocommerce.
If you want to be the first to be notified about the new tutorials then please subscribe to my Youtube channel here
Follow me in Twitter here

Articles: 102