Title: Select field options missing values
Last modified: June 13, 2020

---

# Select field options missing values

 *  Resolved [Viszt Péter](https://wordpress.org/support/users/passatgt/)
 * (@passatgt)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/select-field-options-missing-values/)
 * Hi!
 * On line 131 of class-wc-checkout-field-editor.php, the option for the default
   WooCommerce select is overwritten, but the value attribute is missing:
 * `$options .= '<option '. selected( $value, $option_key, false ) . '>' . esc_attr(
   $option_text ) .'</option>';`
 * Should be this instead:
 * `$options .= '<option '. selected( $value, $option_key, false ) . ' value="'.
   $option_key.'">' . esc_attr( $option_text ) .'</option>';`
 * And on line 141, the select name is appended with []:
 * `$field .= '<select name="' . esc_attr( $key ) . '[]" id="' . esc_attr( $key ).'"
   class="checkout_chosen_select select wc-enhanced-select ' . $class . '">`
 * You can test with this code and see that the option value are missing:
 *     ```
       woocommerce_form_field( 'test', array(
       	'type'        => 'select',
       	'options'     => array(
       		'1' => '1',
       		'2' => '2'
       	),
       ), '2' );
       ```
   
    -  This topic was modified 5 years, 12 months ago by [Viszt Péter](https://wordpress.org/support/users/passatgt/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [themelocation](https://wordpress.org/support/users/themelocation/)
 * (@themelocation)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/select-field-options-missing-values/#post-13002252)
 * Thanks for suggesting missing things. we implement it at update version
 * and line 141 the [] with name thing u mention. it’s because for the select field
   is passed array data. so that’s why we passed this symbol and here we don’t add
   woocommerce form field function because this was totally custom things.

Viewing 1 replies (of 1 total)

The topic ‘Select field options missing values’ is closed to new replies.

 * ![](https://ps.w.org/add-fields-to-checkout-page-woocommerce/assets/icon-128x128.
   png?rev=1786150)
 * [Custom WooCommerce Checkout Fields Editor](https://wordpress.org/plugins/add-fields-to-checkout-page-woocommerce/)
 * [Support Threads](https://wordpress.org/support/plugin/add-fields-to-checkout-page-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/add-fields-to-checkout-page-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/add-fields-to-checkout-page-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/add-fields-to-checkout-page-woocommerce/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [themelocation](https://wordpress.org/support/users/themelocation/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/select-field-options-missing-values/#post-13002252)
 * Status: resolved