I've been struggling with this for a few days now. What I want to do, it to limit the Postcode/zip fields to 4 numbers. So, to add a maxlength and a type="number" to those fields.
Things I've tried so far:
(functions.php)
add_filter( 'woocommerce_checkout_fields', 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { $fields['billing']['postcode']['maxlength'] = 4; return $fields; }
(functions.php) a jQuery way
(Unable to post, due some sort of code format error?)
EDIT: As it turned out, i was editing the old files on the server ... after editing the right one, the maxlength change works fine as the previously supplied code. But there is still the issue of changing the input type.
i tried adding $fields['billing']['billing_postcode']['type'] = 'number';
but that seems to REMOVE the input field all together for some reason. Possibly due to some error i guess. Not sure.