Pramod Sivadas
Pramod Sivadas

Reputation: 893

Woocommerce Wordpress Plugin Change the Checkout Flow

I am using Woocommerce wordpress plugin in my site. When I am in the Cart page and click "proceed to checkout" I am now going to checkout page. I want to change this flow as below.

If the user is not logged in, he should be taken to a different url. If user is logged in he will go to checkout page as usual.

Any help is appreciated.

Upvotes: 2

Views: 655

Answers (1)

deemi-D-nadeem
deemi-D-nadeem

Reputation: 2514

First you create a page where you want to redirect the guest user, for example register

then write this code in your functions.php

function restrict_user() {
    if (! is_user_logged_in() && (is_checkout())) {
        wp_redirect("http://your site url.com/register/");
        exit;
    }
}
add_action('template_redirect', 'restrict_user');

Hope this will help you...

Upvotes: 3

Related Questions