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: 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 CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=19122
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 2.4.7
 */

// Change address field at checkout

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

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

Share:

Leave a Reply