Custom Registration Form

Ukończone Opublikowano 7 lat temu Płatność przy odbiorze
Ukończone Płatność przy odbiorze

Need a custom registration form for [login to view URL] for woo commerce where some fields are 'required' and some optional and will copy all the information to 'bill to'.

After registration, will send an email to user to validate email address.

Sample:

<?php

// Add custom Theme Functions here

function wooc_extra_register_fields() {?>

<p class="form-row form-row-wide">

<label for="reg_billing_phone"><?php _e( 'Phone', 'woocommerce' ); ?></label>

<input type="text" class="input-text" name="billing_phone" id="reg_billing_phone" value="<?php esc_attr_e( $_POST['billing_phone'] ); ?>" />

</p>

<p class="form-row form-row-first">

<label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label>

<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />

</p>

<p class="form-row form-row-last">

<label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?><span class="required">*</span></label>

<input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" />

</p>

<div class="clear"></div>

<?php

}

add_action( 'woocommerce_register_form_start', 'wooc_extra_register_fields' );

/**

* Below code save extra fields.

*/

function wooc_save_extra_register_fields( $customer_id ) {

if ( isset( $_POST['billing_phone'] ) ) {

// Phone input filed which is used in WooCommerce

update_user_meta( $customer_id, 'billing_phone', sanitize_text_field( $_POST['billing_phone'] ) );

}

if ( isset( $_POST['billing_first_name'] ) ) {

//First name field which is by default

update_user_meta( $customer_id, 'first_name', sanitize_text_field( $_POST['billing_first_name'] ) );

// First name field which is used in WooCommerce

update_user_meta( $customer_id, 'billing_first_name', sanitize_text_field( $_POST['billing_first_name'] ) );

}

if ( isset( $_POST['billing_last_name'] ) ) {

// Last name field which is by default

update_user_meta( $customer_id, 'last_name', sanitize_text_field( $_POST['billing_last_name'] ) );

// Last name field which is used in WooCommerce

update_user_meta( $customer_id, 'billing_last_name', sanitize_text_field( $_POST['billing_last_name'] ) );

}

}

add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' );

PHP WooCommerce WordPress

Numer ID Projektu: #12985355

O projekcie

33 ofert Zdalny projekt Aktywny 7 lat temu

Przyznany użytkownikowi:

$30 CAD w ciągu 0 dni
(137 ocen)
6.0

33 freelancerów złożyło ofertę za $56 w tym projekcie

DSAssociates

Hello There, Very excited and glad to see that you are from Canada, as i visit frequently to catch up with my clients.. My name is DS, New Zealand based freelance designer/developer here. With more than 12 years of Więcej

$50 CAD w ciągu 2 dni
(36 Oceny)
6.4
coderzzzz

Hi I have studied the details and I am ready to do this job. Please avoid system generated auto proposals, which have not ever seen your project details, and this will help you to avoid time and money wastage. I Więcej

$111 CAD w ciągu 1 dnia
(29 Oceny)
5.8
abbasjami47

4+ years in web development. Specialist in WORDPRESS, CODEIGNITER, E-COMMERCE, CMS, CORE PHP, PROPERTY, RENTAL, TOURISM, PAYMENT GATEWAYS, PAYPAL, GOOGLE and RESPONSIVE DESIGNS. Bringing 4 years of WEB DEVELOPMENT Więcej

$15 CAD w ciągu 1 dnia
(34 Oceny)
5.6
tanpn89

Hi, Please tell me more details about the fields and changes you need to make on the REgister Form so we can discuss more and I can start to implement it for you now. Regards, Tan.

$60 CAD w ciągu 2 dni
(75 Oceny)
5.8
expertteamindia

come for further discussion

$35 CAD w ciągu 1 dnia
(38 Oceny)
5.1