0
votes

I'm trying to add the bootstrap class "form-control" to all the woocommerce address fields under my account and also when you do a check out.

Basically I want to add the class "form-control" to all the billing address and shipping address input fields. I've tried everything and also looked at the documentation here https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

I also found another post Add custom css class to WooCommerce checkout fields

I've tried everything but nothing seems to update the fields or add a class. I've tried just adding one of the examples in my functions.php file but it doesn't seem to work.

Would anyone be able to help me?

Thank you in advance.

1

1 Answers

5
votes

try this

add_filter('woocommerce_form_field_args',  'wc_form_field_args',10,3);
  function wc_form_field_args($args, $key, $value) {
  $args['input_class'] = array( 'form-control' );
  return $args;
}