Skip to content

Commit 3ab7b70

Browse files
committed
B2B-2423: Optimize addProductsToCart operations
1 parent 25bb760 commit 3ab7b70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/code/Magento/Quote/Model/Cart/AddProductsToCart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private function addItemToCart(Quote $cart, Data\CartItem $cartItem, int $cartIt
187187
);
188188
} else {
189189
$product = $this->productReader->getProductBySku($sku);
190-
if (!$product) {
190+
if (!$product || !$product->isSaleable() || !$product->isAvailable()) {
191191
$errors[] = $this->createError(
192192
__('Could not find a product with SKU "%sku"', ['sku' => $sku])->render(),
193193
$cartItemPosition

0 commit comments

Comments
 (0)