Skip to content

REST API catalogProductRepositoryV1 overwriting default values #9186

Closed
@giano574

Description

@giano574

Preconditions

  1. Magento 2

Steps to reproduce

This demonstration is only with a single storeview, but can be reproduced with multiple storeviews or multiple websites like already mentioned by a bunch of other reporters above

  1. Setup a clean Magento installation using the 2.2-develop branch (I used commit eb84c53)

  2. Go into the backend

  3. Make a note of the default storeview code, it's default (we'll need this later when we create an API request)

  4. Create a new product:

    • name: "Base"
    • SKU: "base"
    • price: 100
    • description: "Base"
    • short description: "Base"
  5. Look at the various catalog_product_entity_int, catalog_product_entity_text, catalog_product_entity_varchar tables in the database, they contain only values for store_id = 0, this is good so far!

  6. Still in the backend, go to System > Integrations and add a new integration with full access

  7. Activate the new integration and take a note of the 'access token' (example: abc)

  8. Execute the following curl command, which only updates the "name" attribute, using the storeview code from 3, and the access token from 7:

curl -k -X PUT -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer abc" -d "{ \"product\": { \"name\": \"New name on storeview level\" }}" https://domain/rest/default/V1/products/base
  1. Go back in the backend and take a look at the product, but switch to the 'Default Store View' scope.

  2. It is expected that the

  3. Also take a look at the database again, to the catalog_product_entity_int, catalog_product_entity_text, catalog_product_entity_varchar tables, it is expected you'll only see one entry for store_id = 1, but there are like 10 entries, not good!

Expected result

Only attribute where the checkmark "Use Default Value" is unchecked is for the attribute "name"

Actual result

All the following attributes now also have a value on storeview level, which is not what is expected:
- status
- tax class
- visibility
- description
- short description
- url key
- meta title
- meta keywords
- meta description
- display product options in

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Framework/WebapiUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just 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 developmentProgress: doneReproduced 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 releaseTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itbug report

    Type

    No type

    Projects

    • Status

      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions