Skip to content

Commit cf13b9d

Browse files
committed
MC-38917: Unexpected order cancellation
1 parent f8dd0b5 commit cf13b9d

File tree

1 file changed

+18
-0
lines changed
  • app/code/Magento/Sales/Controller/Adminhtml/Order/Create

1 file changed

+18
-0
lines changed

app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Index.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ class Index extends \Magento\Sales\Controller\Adminhtml\Order\Create implements
2020
public function execute()
2121
{
2222
$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+
2329
$this->_getOrderCreateModel()->initRuleData();
2430
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
2531
$resultPage = $this->resultPageFactory->create();
@@ -28,4 +34,16 @@ public function execute()
2834
$resultPage->getConfig()->getTitle()->prepend(__('New Order'));
2935
return $resultPage;
3036
}
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+
}
3149
}

0 commit comments

Comments
 (0)