Skip to content

Instantly share code, notes, and snippets.

@mtx-z
Created December 11, 2019 11:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mtx-z/df5738ce79337aae7a167edf98eb7971 to your computer and use it in GitHub Desktop.
Save mtx-z/df5738ce79337aae7a167edf98eb7971 to your computer and use it in GitHub Desktop.
Add bootstrap 4.4 styling to Woocommerce checkout shipping and billing form
<?php
/**
* 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment