@@ -1829,20 +1829,12 @@ protected function _validateCustomerData(\Magento\Customer\Api\Data\CustomerInte
1829
1829
*/
1830
1830
public function _prepareCustomer ()
1831
1831
{
1832
- /** @var $store \Magento\Store\Model\Store */
1833
- $ store = $ this ->getSession ()->getStore ();
1834
- $ customer = $ this ->getQuote ()->getCustomer ();
1835
1832
if ($ this ->getQuote ()->getCustomerIsGuest ()) {
1836
- $ customerBillingAddressDataObject = $ this ->getBillingAddress ()->exportCustomerAddress ();
1837
- $ customer ->setFirstname ($ customerBillingAddressDataObject ->getFirstname ())
1838
- ->setLastname ($ customerBillingAddressDataObject ->getLastname ())
1839
- ->setMiddlename ($ customerBillingAddressDataObject ->getMiddlename ())
1840
- ->setStoreId ($ store ->getId ())
1841
- ->setWebsiteId ($ store ->getWebsiteId ());
1842
- $ customer = $ this ->_validateCustomerData ($ customer );
1843
- $ this ->getQuote ()->setCustomer ($ customer );
1844
1833
return $ this ;
1845
1834
}
1835
+ /** @var $store \Magento\Store\Model\Store */
1836
+ $ store = $ this ->getSession ()->getStore ();
1837
+ $ customer = $ this ->getQuote ()->getCustomer ();
1846
1838
1847
1839
if ($ customer ->getId () && !$ this ->_customerIsInStore ($ store )) {
1848
1840
/** Create a new customer record if it is not available in the specified store */
@@ -2012,6 +2004,15 @@ public function createOrder()
2012
2004
$ oldOrder ->setRelationChildId ($ order ->getId ());
2013
2005
$ oldOrder ->setRelationChildRealId ($ order ->getIncrementId ());
2014
2006
$ oldOrder ->save ();
2007
+ if ($ order ->getCustomerIsGuest ()) {
2008
+ $ quote ->setCustomerFirstname ($ oldOrder ->getCustomerFirstname ());
2009
+ $ quote ->setCustomerMiddlename ($ oldOrder ->getCustomerMiddlename ());
2010
+ $ quote ->setCustomerLastname ($ oldOrder ->getCustomerLastname ());
2011
+ $ quote ->save ();
2012
+ $ order ->setCustomerFirstname ($ oldOrder ->getCustomerFirstname ());
2013
+ $ order ->setCustomerMiddlename ($ oldOrder ->getCustomerMiddlename ());
2014
+ $ order ->setCustomerLastname ($ oldOrder ->getCustomerLastname ());
2015
+ }
2015
2016
$ this ->orderManagement ->cancel ($ oldOrder ->getEntityId ());
2016
2017
$ order ->save ();
2017
2018
}
0 commit comments