Skip to content

Commit

Permalink
Simplify with max()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-GG authored Jan 20, 2025
1 parent ffe6acd commit 6c30a77
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Model/Resolver/Quote/Backorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
return 0;
}

$stockQty = $stockItem->getQty();
if ($stockQty < 0) {
$stockQty = 0;
}

$difference = $cartItem->getQty() - $stockQty;
$difference = $cartItem->getQty() - max($stockItem->getQty(), 0);
if ($difference <= 0) {
return 0;
}
Expand Down

0 comments on commit 6c30a77

Please sign in to comment.