L
L
ligisayan2019-02-15 19:46:17
WordPress
ligisayan, 2019-02-15 19:46:17

How to login to woocommerce using mobile phone?

Hello! There is a woocommerce store .
How to make such an implementation so that the user entering his mobile phone (without entering SMS) can log in to the site or, if not registered, register, as in the picture below.
5c66eaf7abe49360918824.png
Prompt, please, in what direction to dig? Is it possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
ligisayan, 2019-02-25
@ligisayan

Like this

$order = new WC_Order($order_id);
   $order_email = $order->billing_email;
   $email = email_exists( $order_email );  
   $user = username_exists( $order_email );
   		$random_password = wp_generate_password();
   	$userdata = array(
      'user_pass'          => $random_password,
      'user_login'         => $order_email,
      'first_name'         => $order->billing_first_name,
      'user_email'         => $order_email,
      'role'               => 'customer',
    );
    $userid = wp_insert_user( $userdata );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question