Magenot 2 customer custom attribute not add in frontend but can add in admin (resolved)

You must use customer factory and updateDate to update the custom value

$customer = $this->customerFactory->create();
$customerData = $this->customer->getDataModel();
$customerData->setCustomAttribute(‘cuser_id’, ‘testnew1235′);
$customer->updateData($customerData);
$customer->setData(’email’,”abcd123t@gmail.com”);
$customer->setFirstname(“First Nametestdfdf”);
$customer->setLastname(“Last namesdfadsf”);
$customer->setPassword(“test1123”);

$customer->save();

Leave a Comment