Skip to content

Commit f7a2871

Browse files
committed
Revert "AC-15054: Product Add to Cart issue in Rest API"
This reverts commit c31fdcd.
1 parent 95473fc commit f7a2871

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

app/code/Magento/Quote/Plugin/UpdateCartId.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ private function validateWebsiteAssignment(int $productId, int $storeId): void
131131
{
132132
try {
133133
$product = $this->productRepository->getById($productId, false, $storeId);
134-
if (empty($product->getWebsiteIds())) {
135-
return;
136-
}
137134
$this->checkProductInWebsite($product->getWebsiteIds(), $storeId);
138135
} catch (NoSuchEntityException) {
139136
throw new LocalizedException(__('Product that you are trying to add is not available.'));

app/code/Magento/Quote/Plugin/Webapi/ValidateProductWebsiteAssignment.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ private function checkProductWebsiteAssignment($productId, $storeId): void
9797
{
9898
try {
9999
$product = $this->productRepository->getById($productId, false, $storeId);
100-
if (empty($product->getWebsiteIds())) {
101-
return;
102-
}
103100
$this->validateWebsiteAssignment($product->getWebsiteIds(), $storeId);
104101
} catch (NoSuchEntityException $e) {
105102
throw new LocalizedException(__('Product that you are trying to add is not available.'));
@@ -116,6 +113,7 @@ private function checkProductWebsiteAssignment($productId, $storeId): void
116113
private function validateWebsiteAssignment(?array $websiteIds, int $storeId): void
117114
{
118115
$websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
116+
119117
if (empty($websiteIds) || !in_array($websiteId, $websiteIds, true)) {
120118
throw new LocalizedException(__('Product that you are trying to add is not available.'));
121119
}

0 commit comments

Comments
 (0)