Skip to content

Commit 547b609

Browse files
committed
ACP2E-778: REST API: Product names in cart always use default store view values
1 parent 05fb5fa commit 547b609

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

app/code/Magento/Quote/Model/Quote/Plugin/UpdateQuoteStoreId.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@ public function __construct(
3737
* @param Quote $result
3838
* @return Quote
3939
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
40-
* @throws NoSuchEntityException
4140
*/
4241
public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
4342
{
44-
$storeId = $this->storeManager->getStore()->getId();
45-
if ($storeId) {
46-
$result->setStoreId($storeId);
47-
}
43+
$storeId = $this->storeManager->getStore()
44+
->getId() ?: $this->storeManager->getDefaultStoreView()
45+
->getId();
46+
$result->setStoreId($storeId);
4847

4948
return $result;
5049
}
@@ -58,6 +57,12 @@ public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
5857
*/
5958
public function afterLoadByCustomer(Quote $subject, Quote $result): Quote
6059
{
61-
return $this->afterLoadByIdWithoutStore($subject, $result);
60+
$storeId = $this->storeManager->getStore()->getId();
61+
$defaultStoreId = $this->storeManager->getDefaultStoreView()->getId();
62+
if ($storeId !== $defaultStoreId) {
63+
$result->setStoreId($storeId);
64+
}
65+
66+
return $result;
6267
}
6368
}

0 commit comments

Comments
 (0)