WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Redirect after create an account (2 posts)

  1. fabbb
    Member
    Posted 5 months ago #

    Hello,

    I use woocommerce with plugin members only because I want that visitors must be logged before viewing my products.

    So, if a visitor visit site.com or site.com/shop, he is redirected to site.com/my-account page wich include short code [woocommerce_my_account]

    He can login if he has a account, or create an account and password if he is a new visitor.

    Then I use the following code :

    add_filter('woocommerce_login_redirect', 'ras_login_redirect');
    function ras_login_redirect( $redirect_to ) {
         $redirect_to = 'http:/site.com/shop';
         return $redirect_to;
    }

    After login he is redirected to the products page.

    The problem is that if a new visitor create an account and password, he is redirected to my-account page.

    I would like that he is redirected to the products page also. http:/site.com/shop

    Does anybody have an idea ?

    Sorry for my english ..

    Thanks

    Fabbbb

    https://wordpress.org/plugins/woocommerce/

  2. fabbb
    Member
    Posted 5 months ago #

    /***** PAGE AFTER REGISTRATION *****/
    add_filter ( 'woocommerce_registration_redirect', 'my_registration_redirect');
    function my_registration_redirect( $redirect ) {
    $redirect = 'http://www.site.com/after';
    return $redirect;
    }

    /***** HOME AFTER LOGOUT *****/
    add_filter('logout_url', 'projectivemotion_logout_home', 10, 2);
    function projectivemotion_logout_home($logouturl, $redir)
    {
    $redir = get_option('siteurl');
    return $logouturl . '&redirect_to=' . urlencode($redir);
    }

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.