add bootstrap class to checkout fields woocommerce

Solutions on MaxInterview for add bootstrap class to checkout fields woocommerce by the best coders in the world

showing results for - "add bootstrap class to checkout fields woocommerce"
Elisa
12 Apr 2016
1add_filter('woocommerce_form_field_args',  'wc_form_field_args',10,3);
2  function wc_form_field_args($args, $key, $value) {
3  $args['input_class'] = array( 'form-control' );
4  return $args;
5}
Debora
20 Mar 2017
1/**
2 * Adding bootstrap classes to woocommerce checkout form
3 *
4 * @param $fields
5 * @return mixed
6 */
7function wti_add_bootstrap_to_checkout_fields($fields) {
8    foreach ($fields as &$fieldset) {
9        foreach ($fieldset as &$field) {
10            // Add form-group class around the label and the input
11            $field['class'][] = 'form-group';
12 
13            // Add form-control to the actual input
14            $field['input_class'][] = 'form-control';
15        }
16    }
17 
18    return $fields;
19}
20 
21add_filter('woocommerce_checkout_fields', 'wti_add_bootstrap_to_checkout_fields');
22