diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index e0a7281776de9..50125b7eb5098 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -1051,6 +1051,21 @@ public function beforeDelete() return parent::beforeDelete(); } + /** + * Processing object before save data + * + * @return $this + */ + public function beforeSave() { + // Need to use attribute set or future updates can cause data loss + if (!$this->getAttributeSetId()) { + $this->setAttributeSetId( + CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER + ); + } + return parent::beforeSave(); + } + /** * Processing object after save data *