I use the following code to add custom fields in user registration on the “My Account” page using woocommerce,it worked succesfully, but now i want to change the type of one fields be displayed as a select
to display only 3 state:
– Paris,
– London
– Algiers
So how can I edit this code:
<p class="form-row form-row-last">
<label for="reg_billing_state"><?php _e( 'State', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_state" id="reg_billing_state" value="<?php if ( ! empty( $_POST['billing_state'] ) ) esc_attr_e( $_POST['billing_state'] ); ?>" />
</p>
I have tried this but it doesn’t work!
<p class="form-row form-row-last">
<label for="reg_billing_state"><?php _e( 'Commune', 'woocommerce' ); ?> <span class="required">*</span></label>
<input list="states" class="input-text" name="billing_state" id="reg_billing_state" value="<?php if ( ! empty( $_POST['billing_state'] ) ) esc_attr_e( $_POST['billing_state'] ); ?>" />
<datalist id="states">
<option value="Paris">
<option value="London">
<option value="Algiers">
</datalist>
</p>
Thank you in advanced!
Solved
The solution I found for now is the following: