Skip to content

Commit 7965c9b

Browse files
committed
Fix issue 12479, customer custom attributes lost after save
1 parent 19bec6f commit 7965c9b

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
@@ -1051,6 +1051,21 @@ public function beforeDelete()
10511051
return parent::beforeDelete();
10521052
}
10531053

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

0 commit comments

Comments
 (0)