Redirecting WooCommerce Membership to custom landing page

By Gray Ayer | March 09th, 2022

Estimated reading time: 4 minutes, 11 seconds

We have several clients who we have built membership and subscription membership websites for. Generally, the top product worth promoting are the Monthly Subscription products, since they can create dependable recurring revenue.

Improving the user experience for our client’s customers results in a higher subscriber retention (opposite of subscriber churn). This is one of the key performance indicators (KPI) that we focus on with our WooCommerce site maintenance plans. Often subscriber churn is an indication of how valuable subscribers find your product or service. However if they find it frustrating to use, that means that they’ll only stay on as a paying customer until they find a comparable competitor’s service with a better UI.

To encourage retention, it’s worthwhile to figure out all the pain points customers have. For the monthly subscriber just wanting to access their member content, signing in via the My-Account page can be frustrating as this doesn’t get them their content, but rather, the WooCommerce My Account Dashboard.

Here’s a view of the vanilla default view in an unstyled Storefront theme:

and then, when you click into my membership, it is a very boring table view.

This usually gets cluttered and overwhelming what you were giving people is more than 10 pages at a time, since they’re going to need to paginate.

So we created a gorgeous landing page for the membership, from which all the membership content will be accessible from. This page also has a “hide introduction” checkbox to create a persistent simplified page for return users. This landing page is accessible from any page on the website through the “Membership contact” link at the top of the page. When logged out, this link is hidden and replaced with a login link.

But then, how do customers get to this page? The quick way is to modify the dashboard template via the theme so that there’s a big ol’ obvious link to the content.

example of a quick access button placed on the customer’s WooCommerce dashboard, achieved through modifying a template and placing it in the child theme location woocommerce/dashboard.php

As seen in the screenshot above, this can work well when you have multiple different courses, rather than just one big membership. One drawback is that they can still get distracted with all the account management buttons.

Our solution then is that if they login to the site via the My Account page, to redirect them to our custom membership landing page. If the customer wants to get to the My Account page to manage their subscription, check on their orders, update their profile information, etc., this account page is still easily accessible from one of the links in the top bar of the site.

Because our client’s site also lists products for sale that don’t have anything to do with their subscriber video content, we wanted to make sure that the non-member customers will still go to the traditional WC dashboard.

We placed the following code into a functionality plugin, because even if the theme changes, the customers will still want this same personalized user experience. Please see inline comments for hints as to how to best customize this for yourself. The main places you’re gonna need to customize are filling in the full name of the membership plan (lines 19, 21, 24), and the URL of the page you want to direct members to (line 50).

<?php

function mfix_show_memberships_details ($curr_user_id) {
	if ( is_admin() ) {
		return;
	}

	$customer_memberships = wc_memberships_get_user_memberships( $curr_user_id );
	$former_subscriber = [];
	$active_subscriber = [];

foreach ( $customer_memberships as $customer_membership ) {

	$membership_plans = $customer_membership -> get_plan() -> get_name();
	$membership_plans_array[] = $customer_membership->get_plan()->get_name();
	$membership_plans_status = $customer_membership->get_status();
	$membership_plans_status_array[] = $customer_membership->get_status();

	if (($membership_plans == "NAME OF MEMBERSHIP HERE") && ($membership_plans_status == "cancelled")) {$former_subscriber[] = "former_subscriber";}

	if (($membership_plans == "NAME OF MEMBERSHIP HERE") && ($membership_plans_status == "expired")) {$former_subscriber[] = "former_subscriber";}

	// You must include the full name of each membership that you want this redirect to work for.
	if (($membership_plans == "NAME OF MEMBERSHIP HERE") && ($membership_plans_status == "active")) {$active_subscriber[] = "active_subscriber";}
	}	

	if(!empty($active_subscriber)){
		$current_stats = "active_subscriber";
		return $current_stats;
		exit();
	}
	else if (!empty($former_subscriber)){
		$current_stats = "former_subscriber";
		return $current_stats;
		exit();
	}
	else {
		$current_stats = "potential_member";
		return $current_stats;
		exit();
	}
}

function custom_member_login_redirect( $redirect, $user ) {
        $curr_user_id = $user->ID;
	$current_stats = mfix_show_memberships_details ($curr_user_id);

	if( $current_stats == "active_subscriber" ) {
	//	the URL that you want the subscriber to be redirected to on login
		$redirect = "/LANDING-PAGE-URL/";
	}
	// if you want to send former subscribers a nudge to re-engage via a seperate landing page, here's where you'd create that
	if( $current_stats == "former_subscriber" ) {
	$redirect = "/my-account/";
	}

	return $redirect;
}
add_filter( 'woocommerce_login_redirect', 'custom_member_login_redirect', 10, 2 );

One of the cool things about this code snippet is that it will redirect a user to the page of your choosing ONLY if they are logging in through the WooCommerce My Account login page. If the user is a member/customer, AND also has a functional role in managing the site, such as authors or editors, they will be taken to the WP admin as expected if they login via the traditional wp-login.php page.

We hope this helps others who might be wondering how to create an improved user experience for their membership sites. If you’re a site owner and interested in how we can optimize the UX for your membership based business, contact us today for some ideas on improving your KPIs.

EcommerceUX DesignWooCommerceWordPress

Leave a Reply