Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter gwenauger

    (@gwenauger)

    @hemant-ahir Hi this is the way I’m adding a new woocommerce user :

    `$firstname = $_POST[‘firstname’];
    $lastname = $_POST[‘lastname’];
    $mail = $_POST[‘mail’];
    $password = $_POST[‘password’];

    $company = $_POST[‘company’];
    $siret = $_POST[‘siret’];

    $address = $_POST[‘address’];
    $city = $_POST[‘city’];
    $postcode = $_POST[‘postcode’];
    $country = $_POST[‘country’];
    $state = $_POST[‘state’];

    $phone = $_POST[‘phone’];
    $role = $_POST[‘customer_type’];

    $userdata = array(
    ‘user_login’ => $mail,
    ‘first_name’ => $firstname,
    ‘last_name’ => $lastname,
    ‘user_email’ => $mail,
    ‘user_pass’ => $password,

    );

    $username = $firstname.” “.$lastname;
    $user_id = wc_create_new_customer( $mail, $username, $password );
    var_dump($user_id);
    update_user_meta( $user_id, “self_role”, $role);
    update_user_meta( $user_id, “first_name”, $firstname );
    update_user_meta( $user_id, “last_name”, $lastname);
    update_user_meta( $user_id, “billing_first_name”, $firstname );
    update_user_meta( $user_id, “billing_last_name”, $lastname);
    update_user_meta( $user_id, “billing_company”, $company );
    update_user_meta( $user_id, “billing_email”, $mail );
    update_user_meta( $user_id, “billing_address_1”, $address);
    update_user_meta( $user_id, “billing_city”, $city);
    update_user_meta( $user_id, “billing_postcode”, $postcode );
    update_user_meta( $user_id, “billing_country”, $country);
    update_user_meta( $user_id, “billing_state”, $state );
    update_user_meta( $user_id, “billing_phone”, $phone );
    update_user_meta( $user_id, “shipping_first_name”, $firstname );
    update_user_meta( $user_id, “shipping_last_name”, $lastname);
    update_user_meta( $user_id, “shipping_company”, $company );
    update_user_meta( $user_id, “shipping_address_1”, $address);
    update_user_meta( $user_id, “shipping_city”, $city);
    update_user_meta( $user_id, “shipping_postcode”, $postcode );
    update_user_meta( $user_id, “shipping_country”, $country);
    update_user_meta( $user_id, “shipping_state”, $state );`

    • This reply was modified 4 years ago by gwenauger.
    Thread Starter gwenauger

    (@gwenauger)

    @sterndata Thanks to send me on the good forum have a nice day.

Viewing 2 replies - 1 through 2 (of 2 total)