Function: usePickupPointWidget()
usePickupPointWidget(
__namedParameters):UsePickupPointWidgetResult
Mount a carrier's pickup-point map and get the buyer's choice back.
Handles the parts every storefront otherwise reimplements: loading the script AND its separate stylesheet once, creating the right element for the carrier, wiring up however that carrier reports a choice, and tearing all of it down on unmount.
The hook deliberately does NOT touch the cart. Save the point and select the shipping method in your own handler — and note the order: the method cannot be selected until the cart's shipping address carries the point, otherwise the API rejects it.
Parameters
__namedParameters
Returns
Example
const { mountProps, status } = usePickupPointWidget({
pickupConfig: method.pickupConfig,
onSelect: async (point) => {
await setShippingAddress({ ...address, pickupPoint: { provider, ...point } });
await selectShippingMethod({ shippingMethodId: method.id });
},
});
if (status === 'unsupported') return <PointSearchList method={method} />;
return <div {...mountProps} className="h-96 w-full" />;