Skip to content

Instantly share code, notes, and snippets.

@infusedmj
Created June 22, 2013 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infusedmj/5836280 to your computer and use it in GitHub Desktop.
Save infusedmj/5836280 to your computer and use it in GitHub Desktop.
Add this to your theme's function.php to show first name and last name fields on woocommerce's registration page.
function woo_new_fields() {
?>
<p class="form-row">
<label for="first_name"><?php _e( 'First Name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="first_name" id="first_name" value="<?php if (isset($_POST['first_name'])) echo esc_attr($_POST['first_name']); ?>" />
</p>
<p class="form-row">
<label for="last_name"><?php _e( 'Last Name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="last_name" id="last_name" value="<?php if (isset($_POST['last_name'])) echo esc_attr($_POST['last_name']); ?>" />
</p>
<?php
}
add_action( 'register_form', 'woo_new_fields', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment