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 7
7
8
8
namespace Magento \Catalog \ViewModel \Product \Checker ;
9
9
10
- use Magento \Framework \View \Element \Block \ArgumentInterface ;
11
10
use Magento \Catalog \Api \Data \ProductInterface ;
12
- use Magento \CatalogInventory \Api \StockConfigurationInterface ;
13
11
use Magento \Catalog \Model \Product \Attribute \Source \Status ;
12
+ use Magento \CatalogInventory \Api \StockConfigurationInterface ;
13
+ use Magento \Framework \View \Element \Block \ArgumentInterface ;
14
14
15
15
/**
16
16
* Check is available add to compare.
@@ -39,25 +39,9 @@ public function __construct(StockConfigurationInterface $stockConfiguration)
39
39
public function isAvailableForCompare (ProductInterface $ product ): bool
40
40
{
41
41
if ((int )$ product ->getStatus () !== Status::STATUS_DISABLED ) {
42
- return $ this -> isInStock ( $ product ) || $ this ->stockConfiguration ->isShowOutOfStock ();
42
+ return $ product -> isSalable ( ) || $ this ->stockConfiguration ->isShowOutOfStock ();
43
43
}
44
44
45
45
return false ;
46
46
}
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
- }
63
47
}
You can’t perform that action at this time.
0 commit comments