Fix Error in Checkout when switching from Store-Pickup to Shipping
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
Shippingtab to switch away from store pickup, thecheckoutProvidershipping address was being set to the current value ofquote.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
selectShippingMethodfrom 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
convertAddressTypewhich was repeating tasks done injs/model/pickup-locations-service.js. - Added saving of last used (non-pickup) shipping address, which is restored when switching back to
Shippingtab.
Fixed Issues (if relevant)
- 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)
@magento run all tests
@magento run all tests
@magento run all tests
@magento run all tests
@magento run Functional Tests B2B, Functional Tests CE
@magento run Functional Tests B2B
@magento run all tests
@magento run Functional Tests B2B, Functional Tests CE
@magento run Functional Tests B2B, Functional Tests EE
@magento run all tests
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.