@@ -40,7 +40,7 @@ public function __construct(
40
40
}
41
41
42
42
/**
43
- * Update store id in requested quote by store id from request.
43
+ * Update store id in requested quote by store id from guest's request.
44
44
*
45
45
* @param Quote $subject
46
46
* @param Quote $result
@@ -49,12 +49,7 @@ public function __construct(
49
49
*/
50
50
public function afterLoadByIdWithoutStore (Quote $ subject , Quote $ result ): Quote
51
51
{
52
- $ storeId = $ this ->storeManager ->getStore ()
53
- ->getId () ?: $ this ->storeManager ->getDefaultStoreView ()
54
- ->getId ();
55
- $ result ->setStoreId ($ storeId );
56
-
57
- return $ result ;
52
+ return $ this ->loadQuote ($ result );
58
53
}
59
54
60
55
/**
@@ -67,12 +62,7 @@ public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
67
62
*/
68
63
public function afterLoadByCustomer (Quote $ subject , Quote $ result ): Quote
69
64
{
70
- $ store = $ this ->getStore ($ this ->request ->getPathInfo ());
71
- if ($ store ) {
72
- $ result ->setStoreId ($ store ->getId ());
73
- }
74
-
75
- return $ result ;
65
+ return $ this ->loadQuote ($ result );
76
66
}
77
67
78
68
/**
@@ -89,4 +79,20 @@ private function getStore(string $requestPath): ?StoreInterface
89
79
90
80
return $ stores [$ storeCode ] ?? null ;
91
81
}
82
+
83
+ /**
84
+ * Update store id in requested quote by store id from request.
85
+ *
86
+ * @param Quote $quote
87
+ * @return Quote
88
+ */
89
+ private function loadQuote (Quote $ quote ): Quote
90
+ {
91
+ $ store = $ this ->getStore ($ this ->request ->getPathInfo ());
92
+ if ($ store ) {
93
+ $ quote ->setStoreId ($ store ->getId ());
94
+ }
95
+
96
+ return $ quote ;
97
+ }
92
98
}
0 commit comments