Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to set my custom field that I've created to display the same as how Countries and States are set up. I.E With the styling, and where a user can start typing in the first few letters of the country in order to start filtering out the results (i.e typing in United would populated United States of America.)

This is my code:

echo '<div id="my_custom_checkout_field"><h3>'.__('Valid Pinelands Street Name Please').'</h3>';
woocommerce_form_field( 'my_field_name', array(
    'class'         => array('my-field-class form-row-wide'),
    'label'         => __('Where should we deliver?'),
    'placeholder'   => __('Enter Your Street Address'),
    'type'          => 'select',
    'options'       => array(
        'Forest Drive' => __('Forest Drive', 'woocommerce' ),
        'Kings Drive' => __('Kings Drive', 'woocommerce' ),
        'I Dont Live here' => __('Uh Oh', 'woocommerce' ),
        'Princess Drive' => __('Princess Drive', 'woocommerce' )
    /**if('my_field_name' == 'Uh Oh') {
        echo "Oh No, you need to collect your order!"
    } */
), $checkout->get_value( 'my_field_name' ));

echo '</div>';
share|improve this question
Fairly certain those fields are using the Chosen plugin davidwalsh.name/jquery-chosen so you'd need to probably configure that for your fields. –  helgatheviking Jun 30 '13 at 14:29
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.