Skip to content

Send the saved address selection when loading shipping rates in admin order create - #41722

Open
bluefairydevelopment wants to merge 1 commit into
magento:2.4-developfrom
bluefairydevelopment:fix/41624-reorder-edited-shipping-address
Open

bluefairydevelopment wants to merge 1 commit into
magento:2.4-developfrom
bluefairydevelopment:fix/41624-reorder-edited-shipping-address

Conversation

@bluefairydevelopment

Copy link
Copy Markdown

Description

On admin Reorder, after changing the shipping address (for example the state), the next block reload, such as Get available payment methods, recalculated tax and shipping for the old address-book address. The edited address only took effect on Submit Order.

"Select from existing customer addresses" sits outside the address fields container. So loadShippingRates() posted the edited fields without customer_address_id. Editing a field clears the dropdown in the browser, but the quote kept the saved address id. With the session in reorder mode, SaveHandler then imports that address-book entry over the shipping address on every quote save (ACP2E-1826).

loadShippingRates() now sends the dropdown's value with the address:

  • An edited address is saved as a new one.
  • An untouched saved address still picks up the latest address-book data on reorder.
  • It also fixes picking a different saved address before Get shipping methods and rates, which previously left the old id on the quote.

Fixed Issues

  1. Fixes ShippingAddressPersister overwrites edited shipping address during Admin Reorder #41624

Manual testing scenarios

It reproduces only when the original order is created in the admin, as in the issue: Same As Billing Address unticked, so the shipping address is saved to the address book. An order placed another way does not trigger it.

  1. Tax rates Oregon 20%, Illinois 10%. Customer with a saved Oregon address. Create the order in the admin as in steps 1-3.
  2. Reorder, change the shipping state to Illinois, get shipping rates, choose Flat Rate, click Get available payment methods.
    Before: tax goes back to 20%. After: it stays at 10%.

Tested on 2.4-develop (0af2ad9) in a browser. Integration: ReorderTest::testReorderKeepsEditedShippingAddress and testReorderSavedShippingAddressFollowsAddressBook. Jasmine: scripts.test.js (4 new specs).

Props to PhanQuocPhu for the report and the video that showed the exact steps.

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)

… order create (magento#41624)

The "Select from existing customer addresses" dropdown sits outside the
address fields container, so loadShippingRates() posted the edited address
fields without customer_address_id. Editing a field clears the dropdown in
the browser, but the quote kept the saved address id. On reorder,
SaveHandler imports the saved address book entry over the shipping address
on every quote save while it has a customer_address_id, so the next block
reload (payment methods, totals) replaced the edited address and recomputed
tax and shipping for the old one until the order was submitted.
loadShippingRates() now sends the dropdown's value with the address, so an
edited address is saved as a new one and an untouched saved address still
picks up the latest address book data on reorder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review

Projects

Status: Pending Review

Development

Successfully merging this pull request may close these issues.

ShippingAddressPersister overwrites edited shipping address during Admin Reorder

1 participant