In this guide, we will walk you through how to easily add custom registration form fields to your WooCommerce store. By following our step-by-step instructions, you can gather additional customer data and improve user engagement.
Adding Custom Registration Form Field
We’ll use the woocommerce_register_form_start hook to add a custom phone number field at the top of the registration form.
add_action( 'woocommerce_register_form_start',
function() {
?>
<label><?php esc_html_e( 'Phone', 'woo-cus-field' ); ?></label>
<input type="text" name="phone" value="<?php esc_attr_e( $_POST['phone'] ?? '' ); ?>" />
<?php
}
);
function() {
?>
<label><?php esc_html_e( 'Phone', 'woo-cus-field' ); ?></label>
<input type="text" name="phone" value="<?php esc_attr_e( $_POST['phone'] ?? '' ); ?>" />
<?php
}
);