File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
app/code/Magento/Sales/Controller/Adminhtml/Order/Create Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ class Index extends \Magento\Sales\Controller\Adminhtml\Order\Create implements
20
20
public function execute ()
21
21
{
22
22
$ this ->_initSession ();
23
+
24
+ // Clear existing order in session when creating a new order for a customer
25
+ if ($ this ->getRequest ()->getParam ('customer_id ' )) {
26
+ $ this ->clearSessionOrderData ();
27
+ }
28
+
23
29
$ this ->_getOrderCreateModel ()->initRuleData ();
24
30
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
25
31
$ resultPage = $ this ->resultPageFactory ->create ();
@@ -28,4 +34,16 @@ public function execute()
28
34
$ resultPage ->getConfig ()->getTitle ()->prepend (__ ('New Order ' ));
29
35
return $ resultPage ;
30
36
}
37
+
38
+ /**
39
+ * Clear order data in session
40
+ *
41
+ * @return $this
42
+ */
43
+ private function clearSessionOrderData (): self
44
+ {
45
+ $ this ->_getSession ()->setOrderId (null );
46
+
47
+ return $ this ;
48
+ }
31
49
}
You can’t perform that action at this time.
0 commit comments