
By default, if the field is required only one needs to be ticked.
If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.
Note: this uses the gform_field_validation filter that allows you to filter by form or form and field. See the Gravity Forms documentation for examples of this.
add_filter( 'gform_field_validation', 'checkbox_all_required', 10, 4 );
function checkbox_all_required( $result, $value, $form, $field ) {
if ( 'checkbox' == $field->get_input_type() && $field->isRequired ) {
foreach ( $value as $choice ) {
if ( empty( $choice ) ) {
$result['is_valid'] = false;
$result['message'] = 'All checkboxes must be ticked.';
break;
}
}
}
return $result;
}