php - Changing Postcode field in Woocmmerce's checkout page to drop-down

one text

Solution:

Try to use the following instead:

add_filter( 'woocommerce_default_address_fields' , 'customize_postcode_fields' );
function customize_postcode_fields( $adresses_fields ) {
    $adresses_fields['postcode']['type'] = 'select';
    $adresses_fields['postcode']['input_class'] = array('state_select');
    $adresses_fields['postcode']['options'] = array(
        '' => __('Select your postcode', 'woocommerce'),
        '000001' => '000001',
        '000002' => '000002',
        '000003' => '000003'
    );

    return $adresses_fields;
}

Code goes in functions.php file of your active child theme (or active theme). Tested and works on last WooCommerce version 4.5.1 under Storefront theme.

Source