Skip to content

Commit 3b06fda

Browse files
committed
AC-2904-v1:: Saving product with non-default store scope causes untouched attributes to become store scoped if loaded using ProductRepository
1 parent 6c760b5 commit 3b06fda

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,9 @@ public function save(ProductInterface $product, $saveOptions = false)
605605
$productAttributes = $product->getAttributes();
606606
if ($productAttributes !== null
607607
&& $product->getStoreId() !== Store::DEFAULT_STORE_ID
608-
&& (count($stores) > 1 || count($websites) === 1)
608+
&& (count($stores) > 1 || count($websites) >= 1)
609609
) {
610+
$imageRoles = ['image', 'small_image', 'thumbnail'];
610611
foreach ($product->getAttributes() as $attribute) {
611612
$defaultValue = $attribute->getDefaultValue();
612613
$attributeCode = $attribute->getAttributeCode();
@@ -624,6 +625,7 @@ public function save(ProductInterface $product, $saveOptions = false)
624625
) {
625626
$useDefault[$attributeCode] = '1';
626627
} elseif (!$defaultValue && $value !== null
628+
&& !in_array($attributeCode, $imageRoles)
627629
&& $attribute->getScope() !== EavAttributeInterface::SCOPE_GLOBAL_TEXT
628630
&& $existingProduct->getData($attributeCode) === $value
629631
&& $existingProduct->getOrigData($attributeCode) === $value

0 commit comments

Comments
 (0)