Skip to content

How To Add Custom a Field In WooCommerce Registration Form


How To Add Custom Field In WooCommerce Registration Form?

Sometimes we search on google for an easy solution that can make our project complete successfully and we are unable to find the exact solution what we search for. But if you want to add a custom field on your WooCommerce registration form then this code will make your work lots easier than other solutions. Just code & Paste this code on your theme functions.php or use the code snippets plugin that's it. You can also add an ID for your field.


function woocommerce_edit_my_account_page() {
    return apply_filters( 'woocommerce_forms_field', array(
        'woocommerce_my_account_page' => array(
            'type'        => 'text',
            'label'       => __( 'First Name', 'your-text-domain' ),
            'placeholder' => __( 'irst Name', 'your-text-domain' ),
            'required'    => false,
			'id' => 'arr'
    ) );

function edit_my_account_page_woocommerce() {
    $fields = woocommerce_edit_my_account_page();
    foreach ( $fields as $key => $field_args ) {
        woocommerce_form_field( $key, $field_args );

add_action( 'woocommerce_register_form', 'edit_my_account_page_woocommerce', 15 );

Leave a Reply

Your email address will not be published. Required fields are marked *