1

I use "Digits (WordPress Mobile Number Signup and Login)" for signup by email & SMS ; when non logged in user proceed to checkout , want to redirect to signup form of Digits (not usual woocommerce signup).

In case already logged-in users, they should go following the next step in the checkout process as normal.

appreciate if anybody help.

2
  • in woocommerce -> settings -> Accounts & Privacy, you can unckeck "Allow customers to place orders without an account "
    – Kaperto
    Commented Dec 9, 2019 at 11:28
  • thanks; I have already done but only one message is displayed (login is required) ; so need auto redirect to login page url or shortcode. if add link of login page there, it shows below the checkout page for logged in user too.
    – kookool
    Commented Dec 12, 2019 at 11:38

3 Answers 3

0

I find and use below code for when user in cart page and cart not empty:

add_filter('woocommerce_get_checkout_url', 'dj_redirect_checkout');
function dj_redirect_checkout($url) {
     global $woocommerce;
     if(is_cart() && !is_user_logged_in() ){
          $checkout_url = 'digits login url';
     }
     else{
         $checkout_url='https://yoursite.com/checkout/';
     }
     return  $checkout_url; 
}
0
0

For this purpose, I use a plugin called "Digits" and two of its addons called : Lock page & One click login/signup. After istalling these plugins, I have locked checkout page using plugins settings. so when a users heads to checkout page, a popup appears, and requires user to login using their mobile phone number. after successful login/register, the checkout process begins.

0

Just for those who want to lock the checkout page and prompt a login window to the user, use the code below. No extra addons needed for Digits plugin.

// if the user is not logged in, return him to login before checkout
add_action('template_redirect', 'check_if_logged_in');
function check_if_logged_in() {
    if ( ! is_user_logged_in() && is_checkout() ) {
        $url = site_url('/checkout/?login=true&back=home');
        wp_redirect( $url );
        exit;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.