Woocommerce checkout field maxlength, make input number field only (postcode)

By the time woocommerce_checkout_fields filter is run, the arrays for billing and shipping have already been created.

You can see that here:
https://docs.woothemes.com/wc-apidocs/source-class-WC_Checkout.html#101

If you want to effect the default fields, use this hook.

function wpse215677_checkout_fields ( $fields ) {
    $fields['postcode']['maxlength'] = 4;
    return $fields;
}
add_filter('woocommerce_default_address_fields', 'wpse215677_checkout_fields');

If you want to adjust just the default billing fields:

function wpse215677_checkout_fields ( $fields ) {
    $fields['billing_postcode']['maxlength'] = 4;
    return $fields;
}
add_filter('woocommerce_billing_fields', 'wpse215677_checkout_fields');

Otherwise you just need to edit your array declaration:

$fields['billing_postcode']['maxlength'] = 4;