Im trying to make the postcode field in shipping only to be a select type with my options in woocommerce checkout page:
Unsetting shipping state and post code checkout fields
add_filter( 'woocommerce_checkout_fields' , 'partial_unsetting_checkout_fields' ); function partial_unsetting_checkout_fields( $fields ) { unset($fields['shipping']['woocommerce_checkout_fields']); return $fields; }
Reinserting custom shipping post code checkout field,
add_filter( 'woocommerce_checkout_fields' , 'art_override_default_address_fields' ); function art_override_default_address_fields( $fields ) { $fields['shipping_postcode']['type'] = 'select'; $fields['shipping_postcode']['class'] = array('form-row-wide'); $fields['shipping_postcode']['required'] = true; $fields['shipping_postcode']['label'] = __('Postcode', 'my_theme_slug'); $fields['shipping_postcode']['placeholder'] = __('Enter Postcode', 'my_theme_slug'); $fields['shipping_postcode']['default'] ='Choice 1'; $fields['shipping_postcode']['options'] = array( 'option_1' => 'Choice 1', 'option_2' => 'Choice 2', 'option_3' => 'Choice 3' ); }
How to convert billing postcode to a select field with custom options?