Change WooCommerce Registration Page

Asked at 2017-01-11 21:42:38Z
  • 5 Subscribers

I have an online school website with an existing registration page that I need to use to get specific data from the user (see here:

The problem is that to purchase a course the user is sent through WooCommerce. As part of that process the user is prompted to register using WooCommerce's registration page here: (you may have to add something to your cart to see it: You can add this)

The problem seems to be that the certificate we print, has to have data coming from the first registration page.

Is there a way to force WooCommerce to use the registration form from there or just go to that page first?

I am using Gravity Forms Pro to add these items to the User Registration on the first page.

1 answers in total

LoicTheAztec Posted at 2017-01-12 00:49:31Z

Yes this is completely possible using a custom hooked function.

When a non logged customer will arrive on checkout page (just after cart process), he will be redirected to your specific registration page.

Here is that code:

add_action( 'woocommerce_before_checkout_form', 'redirect_customer_login_access');
function redirect_customer_login_access() {

    // Here the conditions (woocommerce my account pages and unlogged user)
    if( is_checkout() && !is_user_logged_in()){

        // Define HERE your custom login form
        $custom_login_url = site_url('/nvtss/register/');
        // if nvtss is the root of your wordpress web site, the url is going to be:
        // $custom_login_url = site_url('/register/');

        // Redirecting to your custom login area
        wp_redirect( $custom_login_url );

        // always use exit after wp_redirect() function.

Code goes in function.php file of your active child theme (active theme or in any plugin file).

This code is tested and works.

Answer this questsion