Skip to content

Saving via ProductRepository changes untouched attributes #7879

Closed
@ochnygosch

Description

@ochnygosch

Saving a loaded product via the ProductRepository updates attribute values of unchanged attributes. Even loading a product and saving it without making changes can lead to a product no longer using default values for a store.

Preconditions

  1. Magento 2.1.3
  2. Single store mode is disabled

Steps to reproduce

  1. Create a simple product
  2. Make sure this product uses default value for product name (or other attributes) for default store
  3. Load product in a backend controller via getById($productId) method of ProductRepositoryInterface
  4. Save the loaded product via save($product) method of ProductRepositoryInterface

Expected result

  1. No attribute value of the product should have changed. Especially the product name in store 1 should still use the default value

Actual result

  1. The name of the save product is copied from store 0 to store 1 and store 1 no longer uses the default value for the product name

Attached is a sample module that provides a backend controller that loads product with id 1 and saves it without changing an attribute.
ProductSave.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CatalogIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions