Support » Plugin: WooCommerce » WooCommerce + OceanWp

  • Resolved icetechy

    (@icetechy)


    Hi added more fields to my WooCommerce default registration form with the php code, but the problem is that in my backend, the first and last name text fields I added are not saving the keyed in data. when I check the registered user in my backend, neither the first name or last name displays (they are missing). Below is the code I used.

    //add more fields to default registration
    //registration fields
    function wooc_extra_register_fields() {?>

    <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’ );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.