2

I am using magento 2.3.1 and i am trying to register customer from frontend and i am getting following error "The customer email is missing. Enter and try again."

when i try to check in _beforeSave() from Magento\Customer\Model\ResourceModel\Customer doesnt getting email id. I am getting following error when I print the customer object

Array
(
    [created_in] => The XXXXXX XXXXX Store
    [email] => 
    [firstname] => pradeep
    [lastname] => sanku
    [store_id] => 1
    [website_id] => 1
    [addresses] => Array
        (
        )

    [entity_id] => 
    [password_hash] => c230dfa79aedee32b5d1d4645977a806be7bb4bfd0689c120930bdb1a45c2e6e:w4cmFyPTPkTsTYTlH0vSOMQIjNzW3kFJ:1
    [parent_id] => 0
)

Note:- I had debugged more and landed at Magento\Customer\Model\AccountManagement.php :: public function createAccount(CustomerInterface $customer, $password = null, $redirectUrl = '')

in this function $customerEmail = $customer->getEmail(); this variable is coming empty.

4
  • fresh installation?
    – Sohel Rana
    Jul 5, 2019 at 12:09
  • yes fresh installation with data migration from m1 Jul 5, 2019 at 12:21
  • @Pradip have you get any solution on it. I am stuck with the same issue. Oct 14, 2019 at 6:45
  • Any solution guys?
    – Ashish Raj
    Mar 27, 2020 at 15:20

2 Answers 2

0

Please check if the name assigned to the input email tag is "email" and the id assigned is "email_address". In my case, the tag name and id were different.

0

When creating an account, we will be posting data to the CreatePost controller: Magento\Customer\Controller\Account\CreatePost

This controller will extract some of the posted data (for example e-mail) using the CustomerExtractor. This is done on line 368 in Magento 2.4.4.

$customer = $this->customerExtractor->extract('customer_account_create', $this->_request);

The CustomerExtractor will look if the attribute id is present for the customer_account_create form in the database table customer_form_attribute. Please look to see if the e-mail attribute_id is in that table for the customer_account_create form.

Also, it might be possible that the e-mail attribute is not assigned to the customer attributeset.

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