Я добавил:
add_filter( 'woocommerce_form_field_checkboxes', array( $this,'pm_form_field_modify' ), 10, 4);
тогда
public function pm_form_field_modify( $field, $key, $args, $value ) {
ob_start();
$this->pm_print_list_field( $key, $args, $value );
$field = ob_get_clean();
if ( $args['return'] ) {
return $field;
} else {
echo $field;
}
}
Тогда вывод
public function pm_print_list_field( $key, $field_args, $value = null ) {
$value = empty( $value ) && $field_args['type'] === 'checkboxes' ? array() : $value;
?>
<div class="form-row">
<?php
// Disable the checkboxes for Zones
if ($field_args['id'] == 'register-checkboxes' && !is_admin()) {
$field_args['custom_attributes'] = array( 'disabled' => 'disabled' );
}
if ( ! empty( $field_args['label'] ) ) { ?>
<label>
<?php echo $field_args['label']; ?>
<?php if ( ! empty( $field_args['required'] ) ) { ?>
<abbr class="required" title="<?php echo esc_attr__( 'required', 'woocommerce' ); ?>">*</abbr>
<?php } ?>
</label>
<?php } ?>
<ul>
<?php foreach ( $field_args['options'] as $option_value => $option_label ) {
$id = sprintf( '%s_%s', $key, sanitize_title_with_dashes( $option_label ) );
$option_key = $field_args['type'] === 'checkboxes' ? sprintf( '%s[%s]', $key, $option_value ) : $key;
$type = $field_args['type'] === 'checkboxes' ? 'checkbox' : $field_args['type'];
$checked = $field_args['type'] === 'checkboxes' ? in_array( $option_value, $value ) : $option_value == $value;
?>
<li>
<label for="<?php echo esc_attr( $id ); ?>">
<input type="<?php echo esc_attr( $type ); ?>" id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $option_key ); ?>" value="<?php echo esc_attr( $option_value ); ?>" <?php checked( $checked );
// Disable the checkboxes
if ( isset($field_args['custom_attributes']['disabled']) ) {
echo 'disabled="disabled"';
}
?>>
<?php echo $option_label; ?>
</label>
</li>
<?php } ?>
</ul>
</div>
<?php
}
Это отключило группу флажков.