I'm using woocommerce for the first time to create an e-commerce wordpress powered website. I need to apply the bootstrap 4 css form classes and remove the default classes that woocommerce will use to wrap the form elements. Using the inspector I've noticed that a <p class="form-row form-row-first">
tag is added before every <label>
and <input>
, also the inputs are wrapped inside a <span>
tag and this will break all the bootstrap 4 layout. After some headche I've found a similar question here on SO, and I decided to give a try, but the solution will not work for me as I expect.
What I want to do is to create a form that respect the css grid layout of bootstrap like this:
<form>
<div class="form-group">
// form group wrapper for labels and inputs
<label for=""></label>
<input type="text" class="form-control" />
</div>
</div>
This is the basic markup for a bootstrap 4 form. For some fields I want also to use the .form-row
to group two fields like name and last name or similar into columns .col-sm-12 col-md-6 col-lg-6
.
Is this possible by using filters or hooks? I've found the core file that manage the fileds rendering function, but I don't want to edit the file to avoid messing up the code.
Now the billing and checkout form fields have this structure:
Thanks for the help.