File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
app/code/Magento/PageBuilder/Plugin/Catalog/Block/Product Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 9
9
namespace Magento \PageBuilder \Plugin \Catalog \Block \Product ;
10
10
11
11
use Magento \PageBuilder \Model \Catalog \Sorting ;
12
+ use Magento \CatalogInventory \Helper \Stock ;
12
13
13
14
/**
14
15
* Catalog Products List widget block plugin
@@ -21,14 +22,20 @@ class ProductsListPlugin
21
22
private $ sorting ;
22
23
23
24
/**
24
- * ProductsListPlugin constructor.
25
- *
25
+ * @var Stock
26
+ */
27
+ private $ stock ;
28
+
29
+ /**
26
30
* @param Sorting $sorting
31
+ * @param Stock $stock
27
32
*/
28
33
public function __construct (
29
- Sorting $ sorting
34
+ Sorting $ sorting ,
35
+ Stock $ stock
30
36
) {
31
37
$ this ->sorting = $ sorting ;
38
+ $ this ->stock = $ stock ;
32
39
}
33
40
34
41
/**
@@ -42,7 +49,7 @@ public function afterCreateCollection(
42
49
\Magento \CatalogWidget \Block \Product \ProductsList $ subject ,
43
50
\Magento \Catalog \Model \ResourceModel \Product \Collection $ result
44
51
) {
45
-
52
+ $ this -> stock -> addIsInStockFilterToCollection ( $ result );
46
53
$ sortOption = $ subject ->getData ('sort_order ' );
47
54
if (isset ($ sortOption )) {
48
55
$ sortedResult = $ this ->sorting ->applySorting ($ sortOption , $ result );
You can’t perform that action at this time.
0 commit comments