Skip to content

Commit 2322baf

Browse files
Thundargelanivishal
authored andcommitted
Fix issue 12479, customer custom attributes lost after save
1 parent 4f94998 commit 2322baf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/code/Magento/Customer/Model/Customer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,21 @@ public function beforeDelete()
10521052
return parent::beforeDelete();
10531053
}
10541054

1055+
/**
1056+
* Processing object before save data
1057+
*
1058+
* @return $this
1059+
*/
1060+
public function beforeSave() {
1061+
// Need to use attribute set or future updates can cause data loss
1062+
if (!$this->getAttributeSetId()) {
1063+
$this->setAttributeSetId(
1064+
CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER
1065+
);
1066+
}
1067+
return parent::beforeSave();
1068+
}
1069+
10551070
/**
10561071
* Processing object after save data
10571072
*

0 commit comments

Comments
 (0)