I need a help with magento 2. I noticed that when I place an order as a guest, after checkout i can create an account, when i do this, the order is assigned to this email and this order shows in my account page. But when i place an order, then go to homepage and then create an account using email address which i used to place an order this order does not apear on account page.

Have you any idea how to fix this? Probably add some validation when i creat an account but in which file, how does it work?

Thanks in advance.

1 Answer 1


enter image description here

As we can see, when clicking Create an Account button, the page will not redirect to the customer/account/create page directly, the checkout/account/delegateCreate will be taken first.

delegateCreate will create the session data. That's important. The session data needs to be generated.

Success Page > Click Create an account button (generate the session data) > Don't create account, go to other pages > Back to the Create page and create the account > the new account will have the order.

So, the most important thing is that we need to create the session data.


I have a suggestion if you want to reassign the orders to customer. That we can use the Observer and Cron job. But, remember that the order is sensitive info. We must check the condition carefully.

You can take a look at the Observer: vendor/magento/module-sales/Observer/AssignOrderToCustomerObserver.php

  • Thank you for your answer. I'm quit new in magento, and your answer teach me something new. I was wondering, maybe i will use session data, which is create by delegateCreate. Can you give me some tips how to use it? Probably i need custom module with observer in which this session data will be creat. Should i use some event after checkout success? Correct me if i'm wrong. Ofcours i want to set this session data after checkout instead of clicking "create an account"
    – SebastianT
    Jul 11, 2019 at 16:06
  • @SebastianT I will check again and give you my suggestion tomorrow. I'm sleeping now. My time is GMT+7. Jul 11, 2019 at 16:19
  • Thank you very much! :D
    – SebastianT
    Jul 12, 2019 at 6:08
  • If you have a free minute or two i will be gratefull for your tip :D
    – SebastianT
    Jul 12, 2019 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.