magento2
magento2 copied to clipboard
33729: clean the quote shipping address if a new address is passed
Description (*)
Related Pull Requests
Fixed Issues (if relevant)
- Fixes magento/magento2#33729
Manual testing scenarios (*)
- Stores - Configuration - Customers - Customer Configuration - Show Company - Set to Optional and Save
- Reindex and clear cache
- Create Customer Account from front end and sign in
- Added different Shipping Address and Billing Address for the customer from front-end/admin with Company name for both and saved.
- Stores - Configuration - Customers - Customer Configuration - Show Company - Set to No and Save
- Reindex and clear cache
- Front-end - Login as Customer - Add a product to Cart - Checkout - go to Payment Step - Go back to Shipping step - Add different Shipping Address and place Order
- Check DB tables: sales_order_address and customer_address_entity tables
Issue: After placing the order, the shipping address has the previous shipping address's company on it in the database. Now: It's saving the correct information as we are cleaning the shipping address before setting the new one.
Questions or comments
This issue is caused because when Magento assign the new address to the quote address in setShippingAddress
he merges with old data from the previous request, so now as we are cleaning when it's a new address, it's saving right on DB
Contribution checklist (*)
- [x] Pull request has a meaningful description of its purpose
- [x] All commits are accompanied by meaningful commit messages
- [x] All new or changed code is covered with unit/integration tests (if applicable)
- [x] 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)
Hi @jzarowny. Thank you for your contribution Here are some useful tips how you can test your changes using Magento test environment. Add the comment under your pull request to deploy test or vanilla Magento instance:
-
@magento give me test instance
- deploy test instance based on PR changes -
@magento give me 2.4-develop instance
- deploy vanilla Magento instance
:exclamation: Automated tests can be triggered manually with an appropriate comment:
-
@magento run all tests
- run or re-run all required tests against the PR changes -
@magento run <test-build(s)>
- run or re-run specific test build(s) For example:@magento run Unit Tests
<test-build(s)>
is a comma-separated list of build names. Allowed build names are:
-
Database Compare
-
Functional Tests CE
-
Functional Tests EE
, -
Functional Tests B2B
-
Integration Tests
-
Magento Health Index
-
Sample Data Tests CE
-
Sample Data Tests EE
-
Sample Data Tests B2B
-
Static Tests
-
Unit Tests
-
WebAPI Tests
-
Semantic Version Checker
You can find more information about the builds here
:information_source: Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.
For more details, please, review the Magento Contributor Guide documentation.
:warning: According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
I will investigate the failings
It will be more complex to solve than that, seems that the old quote address is merged with the new one on the quote setAddress
method, I will need to think a little more on the fix the implementation
@magento give me test instance
Hi @jzarowny. Thank you for your request. I'm working on Magento instance for you.
Hi @jzarowny, here is your Magento Instance: https://c643d3a349d92149626afa64d54e6be9.instances.magento-community.engineering Admin access: https://c643d3a349d92149626afa64d54e6be9.instances.magento-community.engineering/admin_c7c1 Login: 217b6f7f Password: 475b8b49051b
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
Working on unit test
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Functional Tests B2B, Functional Tests CE, Static Tests, WebAPI Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento give me test instance
Hi @engcom-Alfa. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Alfa, here is your Magento Instance: https://c643d3a349d92149626afa64d54e6be9.instances.magento-community.engineering Admin access: https://c643d3a349d92149626afa64d54e6be9.instances.magento-community.engineering/admin_51ee Login: dfc23231 Password: 4de33c8263c2
@magento run Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
:heavy_check_mark: QA Passed
Preconditions:
- Have a Magento Installed with sample data
Manual testing scenario:
-
Make sure the setting In the admin panel: Stores>Configuration>Customer>Customer Configuration>Name and Address Options> Show Company set to optional or Mandatory
-
Create a new customer in the front end and add one billing and shipping address. Save the addresses.
-
Change the setting to: Stores>Configuration>Customer>Customer Configuration>Name and Address Options> Show Company to No
-
Clear cache and re index.
-
In the front end: Login as a same above created customer; add a product to cart; checkout; and add a new customer; go next; Check the checkbox of same billing and shipping address; place the order
-
Check the updated sales_order_address table and customer_address_entity tables in the database; and check if the company column is updated!
Before: :heavy_multiplication_x: Company column was getting updated with older company name
After: :heavy_check_mark: Company column is not getting updated now!
Additionally tested with PR updated code: Placed order keeping Show Company-Optional with existing address; Checked the data in the admin>Sales>Shipment details pages; No issue noticed. Placed order keeping Show Company-Optional with new address; Checked the data in the admin>Sales>Shipment details pages; No issue noticed. Placed order keeping Show Company-No with existing address; Checked the data in the admin>Sales>Shipment details pages; No issue noticed. Placed order keeping Show Company-No with new address; Checked the data in the admin>Sales>Shipment details pages; No issue noticed.
No other impact will be there additionally to test since this PR has code update to avoid unwanted updating an unwanted information! Hence no regression is required too
@magento run Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Static Tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.
@magento run Static Tests