Skip to content

Commit e94c9bf

Browse files
author
Oleksandr Iegorov
committed
MC-38575: cannot set bundle attributes required_options and has_options creating/updating bundle product via rest api
1 parent 649e528 commit e94c9bf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/code/Magento/Catalog/Model/Product.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,13 +877,17 @@ public function getAttributes($groupId = null, $skipSuper = false)
877877
*/
878878
public function beforeSave()
879879
{
880-
$this->setHasOptions(false);
881-
$this->setRequiredOptions(false);
880+
if ($this->getData('has_options') === null) {
881+
$this->setHasOptions(false);
882+
}
883+
if ($this->getData('required_options') === null) {
884+
$this->setRequiredOptions(false);
885+
}
882886

883887
$this->getTypeInstance()->beforeSave($this);
884888

885-
$hasOptions = false;
886-
$hasRequiredOptions = false;
889+
$hasOptions = $this->getData('has_options') === "1";
890+
$hasRequiredOptions = $this->getData('required_options') === "1";
887891

888892
/**
889893
* $this->_canAffectOptions - set by type instance only

0 commit comments

Comments
 (0)