Skip to content

Commit 6f82c70

Browse files
committed
ACP2E-778: REST API: Product names in cart always use default store view values
1 parent f693663 commit 6f82c70

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public function __construct(
4141
*/
4242
public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
4343
{
44-
$storeId = $this->storeManager->getStore()
45-
->getId() ?: $this->storeManager->getDefaultStoreView()
46-
->getId();
47-
$result->setStoreId($storeId);
44+
$storeId = $this->storeManager->getStore()->getId();
45+
if ((int)$storeId !== $result->getStoreId()) {
46+
$result->setStoreId($storeId);
47+
}
4848

4949
return $result;
5050
}
@@ -55,13 +55,13 @@ public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
5555
* @param Quote $subject
5656
* @param Quote $result
5757
* @return Quote
58+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5859
* @throws NoSuchEntityException
5960
*/
6061
public function afterLoadByCustomer(Quote $subject, Quote $result): Quote
6162
{
6263
$storeId = $this->storeManager->getStore()->getId();
63-
$defaultStoreId = $this->storeManager->getDefaultStoreView()->getId();
64-
if ($storeId !== $defaultStoreId) {
64+
if ((int)$storeId !== $result->getStoreId()) {
6565
$result->setStoreId($storeId);
6666
}
6767

0 commit comments

Comments
 (0)