Skip to content

REST: Updating a customer without store_id sets the store_id to default  #22869

@808brinks

Description

@808brinks

Preconditions (*)

Magento 2.2.7 and Magento 2.3-develop provided by the bot.

Steps to reproduce (*)

  1. Create multiple store views
  2. Create a customer and set his store view to one that is not the default
  3. Use the rest api to change the first name of the customer (put to PUT rest/V1/customers/8)

I used the following body. (note the missing store_id)

{ "customer":         {
            "id": 1,
            "group_id": 1,
            "default_billing": "0",
            "default_shipping": "0",
            "created_at": "2019-05-13 14:33:11",
            "updated_at": "2019-05-13 14:33:11",
            "created_in": "alternate store view",
            "email": "[email protected]",
            "firstname": "firstname alternate",
            "lastname": "lastname",
            "gender": 0,
            "website_id": 1,
            "addresses": [],
            "disable_auto_group_change": 0
        }
}

Expected result (*)

  1. The first name is changed.
  2. All fields not passed in the PUT call are not changed. (Including store_id).
{
    "items": [
        {
            "id": 1,
            "group_id": 1,
            "default_billing": "0",
            "default_shipping": "0",
            "created_at": "2019-05-13 14:33:11",
            "updated_at": "2019-05-13 14:40:56",
            "created_in": "alternate store view",
            "email": "[email protected]",
            "firstname": "firstname alternate",
            "lastname": "lastname",
            "gender": 0,
            "store_id": 2,
            "website_id": 1,
            "addresses": [],
            "disable_auto_group_change": 0
        }
    ],
    "search_criteria": {
        "filter_groups": [],
        "page_size": 10
    },
    "total_count": 1
}

Actual result (*)

  1. The store_id is changed to the default store_id
{
    "items": [
        {
            "id": 1,
            "group_id": 1,
            "default_billing": "0",
            "default_shipping": "0",
            "created_at": "2019-05-13 14:33:11",
            "updated_at": "2019-05-13 14:40:56",
            "created_in": "alternate store view",
            "email": "[email protected]",
            "firstname": "firstname alternate",
            "lastname": "lastname",
            "gender": 0,
            "store_id": 1,
            "website_id": 1,
            "addresses": [],
            "disable_auto_group_change": 0
        }
    ],
    "search_criteria": {
        "filter_groups": [],
        "page_size": 10
    },
    "total_count": 1
}

Metadata

Metadata

Assignees

Labels

Component: WebapiUse with concrete module component label E.g. "Component: Webapi" + "Catalog"Fixed in 2.2.xThe issue has been fixed in 2.2 release lineIssue: 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.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions