Solution:
This should work with woocommerce_form_field_args
hook, this way:
add_filter( 'woocommerce_form_field_args', 'custom_form_field_args', 10, 3 );
function custom_form_field_args( $args, $key, $value ) {
if ( $args['id'] == 'billing_city' ) {
$args = array(
'label' => __( 'Suburb/City', 'woocommerce' ),
'required' => FALSE,
'clear' => TRUE,
'type' => 'select',
'options' => $options_array,
'class' => array( 'update_totals_on_change' )
);
} // elseif … and go on
return $args;
};
This are he default $args
parameter values:
$defaults = array(
'type' => 'text',
'label' => '',
'description' => '',
'placeholder' => '',
'maxlength' => false,
'required' => false,
'autocomplete' => false,
'id' => $key,
'class' => array(),
'label_class' => array(),
'input_class' => array(),
'return' => false,
'options' => array(),
'custom_attributes' => array(),
'validate' => array(),
'default' => '',
);
References: