Skip to content

Commit 5d9149f

Browse files
committed
MC-16152: Login Only B2B breaks Page Builder preview
- Ensure global out of stock is honoured for ProductList
1 parent e44dcb8 commit 5d9149f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

app/code/Magento/PageBuilder/Plugin/Catalog/Block/Product/ProductsListPlugin.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Magento\PageBuilder\Plugin\Catalog\Block\Product;
1010

1111
use Magento\PageBuilder\Model\Catalog\Sorting;
12+
use Magento\CatalogInventory\Helper\Stock;
1213

1314
/**
1415
* Catalog Products List widget block plugin
@@ -21,14 +22,20 @@ class ProductsListPlugin
2122
private $sorting;
2223

2324
/**
24-
* ProductsListPlugin constructor.
25-
*
25+
* @var Stock
26+
*/
27+
private $stock;
28+
29+
/**
2630
* @param Sorting $sorting
31+
* @param Stock $stock
2732
*/
2833
public function __construct(
29-
Sorting $sorting
34+
Sorting $sorting,
35+
Stock $stock
3036
) {
3137
$this->sorting = $sorting;
38+
$this->stock = $stock;
3239
}
3340

3441
/**
@@ -42,7 +49,7 @@ public function afterCreateCollection(
4249
\Magento\CatalogWidget\Block\Product\ProductsList $subject,
4350
\Magento\Catalog\Model\ResourceModel\Product\Collection $result
4451
) {
45-
52+
$this->stock->addIsInStockFilterToCollection($result);
4653
$sortOption = $subject->getData('sort_order');
4754
if (isset($sortOption)) {
4855
$sortedResult = $this->sorting->applySorting($sortOption, $result);

0 commit comments

Comments
 (0)