Skip to content

Commit b8ed315

Browse files
merge magento-commerce/2.4-develop into magento-tsg/MC-41213
2 parents 6fe7f73 + 7c43e13 commit b8ed315

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace Magento\Catalog\ViewModel\Product\Checker;
99

10-
use Magento\Framework\View\Element\Block\ArgumentInterface;
1110
use Magento\Catalog\Api\Data\ProductInterface;
12-
use Magento\CatalogInventory\Api\StockConfigurationInterface;
1311
use Magento\Catalog\Model\Product\Attribute\Source\Status;
12+
use Magento\CatalogInventory\Api\StockConfigurationInterface;
13+
use Magento\Framework\View\Element\Block\ArgumentInterface;
1414

1515
/**
1616
* Check is available add to compare.
@@ -39,25 +39,9 @@ public function __construct(StockConfigurationInterface $stockConfiguration)
3939
public function isAvailableForCompare(ProductInterface $product): bool
4040
{
4141
if ((int)$product->getStatus() !== Status::STATUS_DISABLED) {
42-
return $this->isInStock($product) || $this->stockConfiguration->isShowOutOfStock();
42+
return $product->isSalable() || $this->stockConfiguration->isShowOutOfStock();
4343
}
4444

4545
return false;
4646
}
47-
48-
/**
49-
* Get is in stock status.
50-
*
51-
* @param ProductInterface $product
52-
* @return bool
53-
*/
54-
private function isInStock(ProductInterface $product): bool
55-
{
56-
$quantityAndStockStatus = $product->getQuantityAndStockStatus();
57-
if (!$quantityAndStockStatus) {
58-
return $product->isSalable();
59-
}
60-
61-
return $quantityAndStockStatus['is_in_stock'] ?? false;
62-
}
6347
}

0 commit comments

Comments
 (0)