61
This challenging task (yet very simple at the end…!) was requested by one of my WooCommerce Support clients. As they trade in USA only, they wanted to force “numbers only” in the ZIP input field, so that letters would not be allowed. Strange WooCommerce doesn’t do this out of the box!
WooCommerce Snippet: Change ZIP to Input Type = Number
/** * @snippet Change a Checkout Field Input Type * @how-to Get tutoraspire.com FREE * @sourcecode https://tutoraspire.com/?p=19109 * @author Tutor Aspire * @compatible WooCommerce 2.4.7 */ // Change field type to number woocommerce checkout function tutoraspire_change_checkout_field_input_type() { echo ""; } add_action( 'woocommerce_after_checkout_form', 'tutoraspire_change_checkout_field_input_type');