@W-18902385 - [BOPIS][Bug] Fix prefilling shipping address bug#2673
@W-18902385 - [BOPIS][Bug] Fix prefilling shipping address bug#2673yunakim714 merged 4 commits intofeature/shop-in-storefrom
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
| body: { | ||
| shippingAddress: {} | ||
| } |
There was a problem hiding this comment.
This doesn't fully clear shippingAddress from the basket shipment. The basket response still contains shippingAddress: { id: 'some-id' }. Does anyone know of any way to fully clear this using the API?
There was a problem hiding this comment.
Workaround was to add the isAddressFilled boolean check to both <ShippingAddress> and <PickupAddress> components
There was a problem hiding this comment.
@yunakim714 I think you can try
/** * Removes a specified shipment and all associated product, gift certificate, shipping, and price adjustment line items from a basket. It is not allowed to remove the default shipment. */ RemoveShipmentFromBasket: 'removeShipmentFromBasket',
There was a problem hiding this comment.
@yhsieh1 I saw this API, but unfortunately we are modifying the shipping address of the default shipment, and thus we cannot delete that shipment.
| * @param {boolean} hasAnyPickupSelected - Whether any items have pickup selected | ||
| * @returns {Promise<void>} | ||
| */ | ||
| const configureShippingMethodIfNeeded = async ( |
There was a problem hiding this comment.
Created a helper function to DRY code
There was a problem hiding this comment.
love it. is it possible to move this to use-pickup-shipment?
| const {data: basket} = useCurrentBasket() | ||
|
|
||
| const selectedShippingAddress = basket?.shipments && basket?.shipments[0]?.shippingAddress | ||
| const isAddressFilled = selectedShippingAddress?.address1 && selectedShippingAddress?.city |
There was a problem hiding this comment.
is this i18n safe to assume addresses have a street and city?
| * @param {boolean} hasAnyPickupSelected - Whether any items have pickup selected | ||
| * @returns {Promise<void>} | ||
| */ | ||
| const configureShippingMethodIfNeeded = async ( |
There was a problem hiding this comment.
love it. is it possible to move this to use-pickup-shipment?
| * @param {Object} selectedStore - The selected store information | ||
| * @returns {Promise<void>} | ||
| */ | ||
| const configureShippingMethodIfNeeded = async ( |
There was a problem hiding this comment.
Moved this helper into the usePickupShipment hook so we can keep pickup logic outside of the PDP page
patricksullivansf
left a comment
There was a problem hiding this comment.
beautiful. thank you
Description
Previously, if the shopper changed the basket from Pickup in Store -> Delivery then went to the Checkout page, they would see the Shipping Address prefilled because the basket's
shippingAddressfield had already been filled out. This PR makes sure that theshippingAddressis cleared, and the<ShippingAddress>and<PickupAddress>components now check if theshippingAddress.address1field has been filled before showing this address to the shopper.Types of Changes
Changes
shippingAddresswhen changing shipping methods of the basketshippingAddress.address1value exists:How to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization