Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Create TextField In WooCommerce Checkout Page?

Looking to improve the WooCommerce checkout page by adding a custom text field to the billing section. This feature is ideal for collecting extra information or obtaining user consent during the checkout process. Then this, solution will help you.

add_filter( 'woocommerce_checkout_fields', 'ts_custom_text_field_below_email' );

function ts_custom_text_field_below_email( $fields ) {
    // Add a custom text area field below the email address field
    $fields['billing']['billing_custom_text_field'] = array(
        'label'       => 'How Did You Hear About Us?',
        'type'        => 'text',
        'required'    => true,
        'class'       => array( 'form-row-wide' ),
        'priority'    => 31,  // Set the priority higher than the email address field (email has priority 30).
        'placeholder' => 'We would love to know how you learned about our store.',
    );

    return $fields;
}

Output


The below output shows that the custom text field has been added to the billing area section of the WooCommerce checkout page.

How to Create TextField In WooCommerce Checkout Page?

Additionally, you can also add a custom checkbox field in WooCommerce checkout page on the billing section that allows you to collect specific information or preferences from customers during the checkout process.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.