Skip to content

Commit 28d25e0

Browse files
author
Stanislav Idolov
authored
ENGCOM-2394: [Forwardport] Prevent running SQL query on every item in the database when the quote is empty #16897
2 parents 78e16d7 + f1636c0 commit 28d25e0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ private function addTierPriceData(ProductCollection $productCollection)
323323
*/
324324
private function removeItemsWithAbsentProducts()
325325
{
326+
if (count($this->_productIds) === 0) {
327+
return;
328+
}
329+
326330
$productCollection = $this->_productCollectionFactory->create()->addIdFilter($this->_productIds);
327331
$existingProductsIds = $productCollection->getAllIds();
328332
$absentProductsIds = array_diff($this->_productIds, $existingProductsIds);

0 commit comments

Comments
 (0)