Skip to content

Commit 5108977

Browse files
committed
ACP2E-412: Cant link configurable options with REST to product created on Backend
1 parent a96f0f7 commit 5108977

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class Type implements OptionSourceInterface
2525
{
2626
const TYPE_SIMPLE = 'simple';
2727

28+
const TYPE_CONFIGURABLE = 'configurable';
29+
2830
const TYPE_BUNDLE = 'bundle';
2931

3032
const TYPE_VIRTUAL = 'virtual';

app/code/Magento/ConfigurableProduct/Model/OptionRepository.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ public function save($sku, OptionInterface $option)
227227
}
228228

229229
try {
230+
if ($product->getTypeId() === ProductType::TYPE_SIMPLE) {
231+
$product->setTypeId(ProductType::TYPE_CONFIGURABLE);
232+
$product->save();
233+
}
230234
$option->save();
231235
} catch (\Exception $e) {
232236
throw new CouldNotSaveException(__('An error occurred while saving the option. Please try to save again.'));

0 commit comments

Comments
 (0)