Skip to content

Commit 2f93680

Browse files
MAGETWO-98522: Adding out of stock items to comparison shows success message but fails
- Fix CR comments
1 parent 645e82e commit 2f93680

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

app/code/Magento/Catalog/ViewModel/Product/Checker/AddToCompareAvailability.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public function __construct(StockConfigurationInterface $stockConfiguration)
3737
*/
3838
public function isAvailableForCompare(ProductInterface $product): bool
3939
{
40-
return $this->isInStock($product) ||
41-
!$this->isInStock($product) && $this->stockConfiguration->isShowOutOfStock();
40+
return $this->isInStock($product) || $this->stockConfiguration->isShowOutOfStock();
4241
}
4342

4443
/**
@@ -54,8 +53,6 @@ private function isInStock(ProductInterface $product): bool
5453
return $product->isSalable();
5554
}
5655

57-
return isset($quantityAndStockStatus['is_in_stock'])
58-
? $quantityAndStockStatus['is_in_stock']
59-
: false;
56+
return isset($quantityAndStockStatus['is_in_stock']) && $quantityAndStockStatus['is_in_stock'];
6057
}
6158
}

0 commit comments

Comments
 (0)