Merge pull request #6535 from devansh-webkul/issues/6463

Fixed there should not be an exception if the admin is trying to add a new variant for the configurable product #6463
This commit is contained in:
Glenn Hermans 2022-07-09 11:40:34 +02:00 committed by GitHub
commit 8d666f784b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -172,9 +172,7 @@ class Configurable extends AbstractType
$permutation[$superAttribute->id] = $variantData[$superAttribute->code]; $permutation[$superAttribute->id] = $variantData[$superAttribute->code];
} }
$variant = $this->createVariant($product, $permutation, $variantData); $this->createVariant($product, $permutation, $variantData);
$this->productImageRepository->upload($variant, $variantData['images'] ?? null);
} else { } else {
if (is_numeric($index = $previousVariantIds->search($variantId))) { if (is_numeric($index = $previousVariantIds->search($variantId))) {
$previousVariantIds->forget($index); $previousVariantIds->forget($index);
@ -293,6 +291,8 @@ class Configurable extends AbstractType
$this->productInventoryRepository->saveInventories($data, $variant); $this->productInventoryRepository->saveInventories($data, $variant);
$this->productImageRepository->upload($data, $variant, 'images');
return $variant; return $variant;
} }