diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 14fbf36301511..685388f9e022e 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -176,17 +176,13 @@ public function isLockedAttribute($attributeCode) */ public function setData($key, $value = null) { - if ($this->hasLockedAttributes()) { - if (is_array($key)) { - foreach ($this->getLockedAttributes() as $attribute) { - if (isset($key[$attribute])) { - unset($key[$attribute]); - } + if ($this->hasLockedAttributes() && is_array($key)) { + foreach ($this->getLockedAttributes() as $attribute) { + if (isset($key[$attribute])) { + unset($key[$attribute]); } - } elseif ($this->isLockedAttribute($key)) { - return $this; } - } elseif ($this->isReadonly()) { + } elseif ($this->isReadonly() || $this->isLockedAttribute($key)) { return $this; }