Skip to content

Commit 3126d53

Browse files
author
Stanislav Idolov
authored
ENGCOM-2395: [Backport] Prevent running SQL query on every item in the database when the quote is empty #16898
2 parents ebb577a + 11d5242 commit 3126d53

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
@@ -272,6 +272,10 @@ protected function _assignProducts()
272272
*/
273273
private function removeItemsWithAbsentProducts()
274274
{
275+
if (count($this->_productIds) === 0) {
276+
return;
277+
}
278+
275279
$productCollection = $this->_productCollectionFactory->create()->addIdFilter($this->_productIds);
276280
$existingProductsIds = $productCollection->getAllIds();
277281
$absentProductsIds = array_diff($this->_productIds, $existingProductsIds);

0 commit comments

Comments
 (0)