How to change input type of woocommerce checkout field?

WooCommerce: Change a Checkout Field Input Type

Woocommerce is great ecommerce plugin. This is highly customizable. Did you ever need to customize woocommerce checkout page? Today’s post is about how to customize woocommerce checkout page by action hook.

If you need to change input type from number to text or text to number, you can use the following function.

function change_checkout_field_input_type() {
echo "<script>document.getElementById('billing_postcode').type = 'number';</script>";
}
 
add_action( 'woocommerce_after_checkout_form', 'change_checkout_field_input_type'); 

This code will go to your themes functions.php file.

This hack is from https://businessbloomer.com/woocommerce-change-input-type-checkout-fields/

Leave a Reply

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