Home » WooCommerce: Change Input Field to Textarea @ Checkout

WooCommerce: Change Input Field to Textarea @ Checkout

by Tutor Aspire

Let’s say you require to make the “address” field at checkout bigger. Instead of an “input type = text”, we’d require an “input type = textarea” in HTML. This was my WooCommerce client’s challenge: how can I edit a checkout field input type programmatically? Here’s the snippet!

WooCommerce: Chenge Input Field to Textarea @ Checkout Page
WooCommerce: Change Input Field to Textarea @ Checkout Page

Snippet: Change Input Field to Textarea @ WooCommerce Checkout Page

/**
 * @snippet       Change Input Field to Textarea @ WooCommerce Checkout
 * @how-to        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=19122
 * @author        Tutor Aspire
 * @compatible    WooCommerce 2.4.7
 */

// Change address field at checkout

add_filter( 'woocommerce_checkout_fields' , 'tutoraspire_change_address_input_type', 10, 1 );

function tutoraspire_change_address_input_type( $fields ) {
$fields['billing']['billing_address_1']['type'] = 'textarea';
return $fields;
}

You may also like