Add bootstrap 4.4 styling to Woocommerce checkout shipping and billing form

Posted on
5/5 - (274 votes)
/**
 * Edit checkout form inputs
 * source: https://gist.github.com/nickkuijpers/5d07ecf9b0a0678b4f4c
 */
add_filter('woocommerce_checkout_fields', 'addBootstrapToCheckoutFields' );
/**
 * @param $fields
 * @return mixed
 */
function addBootstrapToCheckoutFields($fields) {
    foreach ($fields as &$fieldset) {
        foreach ($fieldset as &$field) {
            // if you want to add the form-group class around the label and the input
            $field['class'][] = 'form-group';

            // add form-control to the actual input
            $field['input_class'][] = 'form-control';
        }
    }
    return $fields;
}