File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed
app/code/Magento/Catalog/ViewModel/Product/Checker Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change 77
88namespace Magento \Catalog \ViewModel \Product \Checker ;
99
10- use Magento \Framework \View \Element \Block \ArgumentInterface ;
1110use Magento \Catalog \Api \Data \ProductInterface ;
12- use Magento \CatalogInventory \Api \StockConfigurationInterface ;
1311use 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}
You can’t perform that action at this time.
0 commit comments