I have used following code to add custom state field to WooCommerce checkout field
add_action( 'woocommerce_after_order_notes', 'some_custom_checkout_field' );
function some_custom_checkout_field( $checkout ){
echo '<div id="some_custom_checkout_field"><h2>' . __('Heading') . '</h2>';
woocommerce_form_field( 'some_field_name', array(
'type' => 'state',
'class' => array('my-field-class form-row-wide'),
'label' => __('Additional Field'),
'required' => true,
), $checkout->get_value( 'some_field_name' ));
echo '</div>';
}
My Problem:
When I visit to checkout page for the first time it always create a TEXT BOX instead a State Drop Down, if I refresh the page it works just fine.