Skip to content

Commit

Permalink
Merge pull request #402 from Codeinwp/fix/checkbox-max-selection
Browse files Browse the repository at this point in the history
fix: condition for validation skip for fields with min/max checked
  • Loading branch information
selul authored Oct 7, 2024
2 parents 70f26f2 + 000f53e commit 25bcb16
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions inc/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,19 @@ function ppom_check_validation( $product_id, $post_data, $passed = true ) {
continue;
}

if ( ! isset( $field['required'] ) || 'on' !== $field['required'] ) {
continue;
}

$passed = apply_filters( 'ppom_before_fields_validation', $passed, $field, $post_data, $product_id );

if (
empty( $field['data_name'] ) &&
empty( $field['required'] ) &&
empty( $field['min_checked'] ) &&
empty( $field['max_checked'] )
empty( $field['data_name'] ) ||
(
( ! isset( $field['required'] ) || 'on' !== $field['required'] ) &&
empty( $field['min_checked'] ) &&
empty( $field['max_checked'] )
)
) {
continue;
}

$passed = apply_filters( 'ppom_before_fields_validation', $passed, $field, $post_data, $product_id );

$data_name = sanitize_key( $field['data_name'] );

$title = isset( $field['title'] ) ? $field['title'] : '';
Expand Down

0 comments on commit 25bcb16

Please sign in to comment.