Skip to content

Commit e89b0b1

Browse files
committed
ACP2E-4294: Restricted Category Products Still Counted in Wishlist After Customer Group Update
1 parent eed98dc commit e89b0b1

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItemsResolver.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory as WishlistItemCollectionFactory;
1818
use Magento\Wishlist\Model\Item;
1919
use Magento\Wishlist\Model\Wishlist;
20+
use Magento\Wishlist\Model\WishlistItemSellableCollectionProcessor;
2021

2122
/**
2223
* Fetches the Wishlist Items data according to the GraphQL schema
@@ -26,23 +27,31 @@ class WishlistItemsResolver implements ResolverInterface
2627
/**
2728
* @var WishlistItemCollectionFactory
2829
*/
29-
private $wishlistItemCollectionFactory;
30+
private WishlistItemCollectionFactory $wishlistItemCollectionFactory;
3031

3132
/**
3233
* @var StoreManagerInterface
3334
*/
34-
private $storeManager;
35+
private StoreManagerInterface $storeManager;
36+
37+
/**
38+
* @var WishlistItemSellableCollectionProcessor
39+
*/
40+
private WishlistItemSellableCollectionProcessor $sellableCollectionProcessor;
3541

3642
/**
3743
* @param WishlistItemCollectionFactory $wishlistItemCollectionFactory
3844
* @param StoreManagerInterface $storeManager
45+
* @param WishlistItemSellableCollectionProcessor $sellableCollectionProcessor
3946
*/
4047
public function __construct(
4148
WishlistItemCollectionFactory $wishlistItemCollectionFactory,
42-
StoreManagerInterface $storeManager
49+
StoreManagerInterface $storeManager,
50+
WishlistItemSellableCollectionProcessor $sellableCollectionProcessor
4351
) {
4452
$this->wishlistItemCollectionFactory = $wishlistItemCollectionFactory;
4553
$this->storeManager = $storeManager;
54+
$this->sellableCollectionProcessor = $sellableCollectionProcessor;
4655
}
4756

4857
/**
@@ -92,6 +101,7 @@ private function getWishListItems(Wishlist $wishlist): array
92101
return $store->getId();
93102
}, $this->storeManager->getStores()))
94103
->setVisibilityFilter();
104+
$this->sellableCollectionProcessor->execute($wishlistItemCollection);
95105
return $wishlistItemCollection->getItems();
96106
}
97107
}

app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistResolver.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Wishlist\Model\Wishlist\Config as WishlistConfig;
1717
use Magento\Wishlist\Model\WishlistFactory;
1818
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
19+
use Magento\Wishlist\Model\WishlistItemSellableCollectionProcessor;
1920

2021
/**
2122
* Fetches the Wishlist data according to the GraphQL schema
@@ -37,19 +38,27 @@ class WishlistResolver implements ResolverInterface
3738
*/
3839
private $wishlistConfig;
3940

41+
/**
42+
* @var WishlistItemSellableCollectionProcessor
43+
*/
44+
private WishlistItemSellableCollectionProcessor $sellableCollectionProcessor;
45+
4046
/**
4147
* @param WishlistResourceModel $wishlistResource
4248
* @param WishlistFactory $wishlistFactory
4349
* @param WishlistConfig $wishlistConfig
50+
* @param WishlistItemSellableCollectionProcessor $sellableCollectionProcessor
4451
*/
4552
public function __construct(
4653
WishlistResourceModel $wishlistResource,
4754
WishlistFactory $wishlistFactory,
48-
WishlistConfig $wishlistConfig
55+
WishlistConfig $wishlistConfig,
56+
WishlistItemSellableCollectionProcessor $sellableCollectionProcessor
4957
) {
5058
$this->wishlistResource = $wishlistResource;
5159
$this->wishlistFactory = $wishlistFactory;
5260
$this->wishlistConfig = $wishlistConfig;
61+
$this->sellableCollectionProcessor = $sellableCollectionProcessor;
5362
}
5463

5564
/**
@@ -79,6 +88,7 @@ public function resolve(
7988
if (null === $wishlist->getId()) {
8089
return [];
8190
}
91+
$this->sellableCollectionProcessor->execute($wishlist->getItemCollection());
8292

8393
return [
8494
'sharing_code' => $wishlist->getSharingCode(),
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* ADOBE CONFIDENTIAL
5+
*
6+
* Copyright 2025 Adobe
7+
* All Rights Reserved.
8+
*
9+
* NOTICE: All information contained herein is, and remains
10+
* the property of Adobe and its suppliers, if any. The intellectual
11+
* and technical concepts contained herein are proprietary to Adobe
12+
* and its suppliers and are protected by all applicable intellectual
13+
* property laws, including trade secret and copyright laws.
14+
* Dissemination of this information or reproduction of this material
15+
* is strictly forbidden unless prior written permission is obtained
16+
* from Adobe.
17+
*/
18+
-->
19+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
20+
<event name="catalog_product_collection_load_after">
21+
<observer name="magento_catalogpermissions" instance="Magento\CatalogPermissions\Observer\ApplyProductPermissionOnCollectionAfterLoadObserver"/>
22+
</event>
23+
</config>

0 commit comments

Comments
 (0)