diff --git a/src/Core/Form/IdentifiableObject/CommandBuilder/Product/CustomizationFieldsCommandsBuilder.php b/src/Core/Form/IdentifiableObject/CommandBuilder/Product/CustomizationFieldsCommandsBuilder.php index 5de266048478c..091ce84c86b48 100644 --- a/src/Core/Form/IdentifiableObject/CommandBuilder/Product/CustomizationFieldsCommandsBuilder.php +++ b/src/Core/Form/IdentifiableObject/CommandBuilder/Product/CustomizationFieldsCommandsBuilder.php @@ -74,7 +74,7 @@ private function buildCustomizationFields(array $customizationsFormData): array 'type' => (int) $customization['type'], 'localized_names' => $customization['name'], 'is_required' => (bool) $customization['required'], - 'added_by_module' => false, + 'added_by_module' => isset($customization['addedByModule']) ? (bool) $customization['addedByModule'] : false, 'id' => isset($customization['id']) ? (int) $customization['id'] : null, ]; } diff --git a/src/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProvider.php b/src/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProvider.php index a228400cf156c..aa6e6d22c5b8b 100644 --- a/src/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProvider.php +++ b/src/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProvider.php @@ -616,6 +616,7 @@ private function extractCustomizationsData(ProductForEditing $productForEditing, 'name' => $customizationField->getLocalizedNames(), 'type' => $customizationField->getType(), 'required' => $customizationField->isRequired(), + 'addedByModule' => $customizationField->isAddedByModule(), ]; } diff --git a/tests/Unit/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProviderTest.php b/tests/Unit/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProviderTest.php index d578fc3796045..d8ff22595fb82 100644 --- a/tests/Unit/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProviderTest.php +++ b/tests/Unit/Core/Form/IdentifiableObject/DataProvider/ProductFormDataProviderTest.php @@ -1008,12 +1008,14 @@ private function getDatasetsForCustomizations(): array 'name' => $localizedNames, 'type' => 1, 'required' => false, + 'addedByModule' => false, ], [ 'id' => 2, 'name' => $localizedNames, 'type' => 0, 'required' => true, + 'addedByModule' => false, ], ], ]; @@ -1024,12 +1026,14 @@ private function getDatasetsForCustomizations(): array 'name' => $localizedNames, 'type' => CustomizationFieldType::TYPE_TEXT, 'required' => false, + 'addedByModule' => false, ], [ 'id' => 2, 'name' => $localizedNames, 'type' => CustomizationFieldType::TYPE_FILE, 'required' => true, + 'addedByModule' => false, ], ];