Skip to content

[Issue] Add note to setCustomer on quote about quote addresses removal #37400

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #35773: Add note to setCustomer on quote about quote addresses removal


Description (*)

While working on one of the features, we noticed that the method \Magento\Quote\Model\Quote::setCustomer not only sets the customer but also copies data from the customer to quote AND REMOVES QUOTE ADDRESSES, which is not obvious at all.

Removing of this behavior probably will cause the issue for the code that relies on this behavior, so I think we can't do that in the class and interface marked with @api tag.

The last thing caused a pretty big issue for us on checkout, as we missed checking the details of the implementation for the setCustomer method and thought it was just a regular setter.

I would like to deprecate it, but I didn't find any alternative to replace it fully w/o doing the only needed thing, so don't do that now.
Also, I can't add a new method to this class since it's marked with @api tag that will cause the SVC failure, require additional approval process, etc.

Just an idea - Maybe we should deprecate the getCustomer and setCustomer methods with getCustomerId and getCustomerId alternatives?

Note: the methods getCustomer and setCustomer also declared in \Magento\Quote\Api\Data\CartInterface, I belive we should deprecate them as well.

Related Pull Requests

Fixed Issues (if relevant)

  1. N/A

Manual testing scenarios (*)

  1. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Area: FrameworkComponent: QuoteIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions