Skip to content

Commit

Permalink
Merge pull request #156 from Codeinwp/fix/conflict_w_woocommerce_min_q
Browse files Browse the repository at this point in the history
fix: do not enforce step min quantity if quantity already set …
  • Loading branch information
vytisbulkevicius authored Aug 31, 2023
2 parents fd12274 + e93ca7a commit efa5515
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inc/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function ppom_validation_product_limits( $data, $product ) {
}
}

if ( empty( $limits['min_qty'] ) && ! $product->is_type( 'group' ) && $limits['step'] > 0 ) {
if ( empty( $limits['min_qty'] ) && ! $product->is_type( 'group' ) && $limits['step'] > 0 && $data['min_value'] <= 1 ) {
$data['min_value'] = $limits['step'];
}

Expand Down Expand Up @@ -227,7 +227,7 @@ function ppom_validation_variation_limits( $data, $product, $variation ) {
}
}

if ( empty( $limits['min_qty'] ) && ! $product->is_type( 'group' ) && $limits['step'] > 0 ) {
if ( empty( $limits['min_qty'] ) && ! $product->is_type( 'group' ) && $limits['step'] > 0 && $data['min_qty'] <= 1 ) {
$data['min_qty'] = $limits['step'];
}

Expand Down

0 comments on commit efa5515

Please sign in to comment.