Skip to content

Commit e90810a

Browse files
author
Prabhu Ram
committed
compare-products - Fixed errors on creating comparelist and adding products.
1 parent a99515d commit e90810a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/code/Magento/CompareListGraphQl/Model/Service/AddToCompareList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public function execute(int $listId, array $products, ContextInterface $context)
6262
{
6363
$storeId = (int)$context->getExtensionAttributes()->getStore()->getStoreId();
6464
$customerId = $context->getUserId();
65+
if ($customerId) {
66+
$this->itemCollection->setListIdToCustomerCompareItems($listId, $customerId);
67+
}
68+
6569
if (count($products)) {
6670
$existedProducts = $this->itemCollection->getProductsByListId($listId);
6771
foreach ($products as $productId) {
@@ -80,10 +84,6 @@ public function execute(int $listId, array $products, ContextInterface $context)
8084
}
8185
}
8286

83-
if ($customerId) {
84-
$this->itemCollection->setListIdToCustomerCompareItems($listId, $customerId);
85-
}
86-
8787
return (int)$listId;
8888
}
8989

0 commit comments

Comments
 (0)