Fix WooCommerce checkbox input

Problem: Calling `woocommerce_form_field()` for input type `checkbox` results in a hidden checkbox.
Fix: Adjust the `understrap_wc_form_field_args` filter to make `woocommerce_form_field()` render valid Bootstrap markup.
This commit is contained in:
IanDelMar 2020-06-17 14:02:52 +02:00
parent 44cc2383bd
commit ab3fe5b52f
1 changed files with 7 additions and 4 deletions

View File

@ -122,10 +122,13 @@ if ( ! function_exists( 'understrap_wc_form_field_args' ) ) {
$args['input_class'] = array( 'form-control' );
break;
case 'checkbox':
// Add a class to the form input's <label> tag.
$args['label_class'] = array( 'custom-control custom-checkbox' );
$args['input_class'] = array( 'custom-control-input' );
break;
$args['class'][] = 'form-group';
// Wrap the label in <span> tag.
$args['label'] = isset( $args['label'] ) ? '<span class="custom-control-label">' . $args['label'] . '<span>': '';
// Add a class to the form input's <label> tag.
$args['label_class'] = array( 'custom-control custom-checkbox' );
$args['input_class'] = array( 'custom-control-input' );
break;
case 'radio':
$args['label_class'] = array( 'custom-control custom-radio' );
$args['input_class'] = array( 'custom-control-input' );