Skip to content

Commit 7d1accf

Browse files
committed
remove pick up in store link from checkout page
1 parent 4f56e72 commit 7d1accf

File tree

1 file changed

+7
-51
lines changed

1 file changed

+7
-51
lines changed

packages/template-retail-react-app/app/pages/checkout-one-click/partials/one-click-shipping-address.jsx

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,9 @@ import {
2424
import {useCurrentCustomer} from '@salesforce/retail-react-app/app/hooks/use-current-customer'
2525
import {useCurrentBasket} from '@salesforce/retail-react-app/app/hooks/use-current-basket'
2626
import {useToast} from '@salesforce/retail-react-app/app/hooks/use-toast'
27-
import {Text, Button, Box} from '@salesforce/retail-react-app/app/components/shared/ui'
27+
import {Text} from '@salesforce/retail-react-app/app/components/shared/ui'
2828
import {isPickupShipment} from '@salesforce/retail-react-app/app/utils/shipment-utils'
2929
import {getConfig} from '@salesforce/pwa-kit-runtime/utils/ssr-config'
30-
import {useSelectedStore} from '@salesforce/retail-react-app/app/hooks/use-selected-store'
31-
import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation'
32-
import usePickupShipment from '@salesforce/retail-react-app/app/hooks/use-pickup-shipment'
33-
import {STORE_LOCATOR_IS_ENABLED} from '@salesforce/retail-react-app/app/constants'
3430

3531
const submitButtonMessage = defineMessage({
3632
defaultMessage: 'Continue to Shipping Method',
@@ -68,11 +64,6 @@ export default function ShippingAddress() {
6864

6965
const hasMultipleDeliveryShipments = deliveryShipments.length > 1
7066

71-
const storeLocatorEnabled = getConfig()?.app?.storeLocatorEnabled ?? STORE_LOCATOR_IS_ENABLED
72-
const {selectedStore} = useSelectedStore()
73-
const {navigate} = useNavigation()
74-
const {updatePickupShipment} = usePickupShipment(basket)
75-
7667
// Prepare a shipping methods query we can manually refetch after address updates
7768
const shippingMethodsQuery = useShippingMethodsForShipment(
7869
{
@@ -86,29 +77,6 @@ export default function ShippingAddress() {
8677
}
8778
)
8879

89-
const switchToPickup = async () => {
90-
try {
91-
if (!selectedStore?.inventoryId) {
92-
navigate('/store-locator')
93-
return
94-
}
95-
const refreshed = await currentBasketQuery.refetch()
96-
const latestBasketId = refreshed?.data?.basketId || basket.basketId
97-
await updatePickupShipment(latestBasketId, selectedStore)
98-
await currentBasketQuery.refetch()
99-
goToStep(STEPS.PICKUP_ADDRESS)
100-
} catch (_e) {
101-
toast({
102-
title: formatMessage({
103-
defaultMessage:
104-
'We could not switch to Store Pickup. Please try again or choose a different store.',
105-
id: 'shipping_address.error.switch_to_pickup_failed'
106-
}),
107-
status: 'error'
108-
})
109-
}
110-
}
111-
11280
const submitAndContinue = async (address) => {
11381
setIsLoading(true)
11482
try {
@@ -314,24 +282,12 @@ export default function ShippingAddress() {
314282
onBackToSingle={() => setIsMultiShipping(false)}
315283
/>
316284
) : (
317-
<>
318-
{storeLocatorEnabled && (
319-
<Box mb={3}>
320-
<Button variant="link" onClick={switchToPickup}>
321-
{formatMessage({
322-
defaultMessage: 'Pick up in store',
323-
id: 'shipping_address.action.pickup_in_store'
324-
})}
325-
</Button>
326-
</Box>
327-
)}
328-
<ShippingAddressSelection
329-
selectedAddress={selectedShippingAddress}
330-
submitButtonLabel={submitButtonMessage}
331-
onSubmit={submitAndContinue}
332-
formTitleAriaLabel={shippingAddressAriaLabel}
333-
/>
334-
</>
285+
<ShippingAddressSelection
286+
selectedAddress={selectedShippingAddress}
287+
submitButtonLabel={submitButtonMessage}
288+
onSubmit={submitAndContinue}
289+
formTitleAriaLabel={shippingAddressAriaLabel}
290+
/>
335291
)}
336292
</ToggleCardEdit>
337293
{(hasMultipleDeliveryShipments || isAddressFilled) && (

0 commit comments

Comments
 (0)