inventory icon indicating copy to clipboard operation
inventory copied to clipboard

Fix Error in Checkout when switching from Store-Pickup to Shipping

Open LyraGhost opened this issue 5 years ago • 11 comments

Description (*)

The issue encountered caused the Checkout to break until user signed out. All fixes were contained within a single file: InventoryInStorePickupFrontend/view/frontend/web/js/view/store-pickup.js

Fixes issue:

  • When clicking the Shipping tab to switch away from store pickup, the checkoutProvider shipping address was being set to the current value of quote.shippingAddress(), which would be a store location if one was selected, or another user shipping address if not. (this wasn't causing an issue, but was not changing anything)
  • checkoutProvider.trigger('data.reset') was also being called, which is what triggered the error (described in linked issue) and caused the checkout to break.
  • Changed second line of selectShippingMethod from setting shipping-address (redundantly) to second method necessary for setting shipping-method, as used in Checkout/js/view/shipping.js.

Other changes:

  • Removed redundant function convertAddressType which was repeating tasks done in js/model/pickup-locations-service.js.
  • Added saving of last used (non-pickup) shipping address, which is restored when switching back to Shipping tab.

Fixed Issues (if relevant)

  1. Fixes magento/inventory#3216

Manual testing scenarios (*)

Same as linked issue steps to reproduce.

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] All automated tests passed successfully (all builds are green)

LyraGhost avatar Oct 20 '20 20:10 LyraGhost

@magento run all tests

LyraGhost avatar Oct 20 '20 20:10 LyraGhost

@magento run all tests

LyraGhost avatar Oct 20 '20 21:10 LyraGhost

@magento run all tests

LyraGhost avatar Oct 20 '20 22:10 LyraGhost

@magento run all tests

LyraGhost avatar Oct 20 '20 22:10 LyraGhost

@magento run Functional Tests B2B, Functional Tests CE

swnsma avatar Oct 23 '20 08:10 swnsma

@magento run Functional Tests B2B

LyraGhost avatar Oct 28 '20 21:10 LyraGhost

@magento run all tests

LyraGhost avatar Oct 29 '20 14:10 LyraGhost

@magento run Functional Tests B2B, Functional Tests CE

LyraGhost avatar Oct 29 '20 18:10 LyraGhost

@magento run Functional Tests B2B, Functional Tests EE

LyraGhost avatar Nov 06 '20 17:11 LyraGhost

@magento run all tests

LyraGhost avatar Dec 03 '20 20:12 LyraGhost

Haven't had a chance to test if the recent changes to InventoryInStorePickupFrontend/view/frontend/web/js/view/store-pickup.js fix the original issue and/or if it conflicts with my fixes. I'll update here when I get a chance to test it.

LyraGhost avatar Apr 22 '21 16:04 LyraGhost