Przejdź do głównej zawartości

Function: usePickupPointSearch()

usePickupPointSearch(__namedParameters): UsePickupPointSearchResult

Search a carrier's collection points — the list you render when a shipping method uses selectionMode: 'SEARCH' instead of a map.

Debounces the buyer's typing and discards a reply that arrives after a newer search started, so typing "Krak" then "Kraków" cannot leave the results of the first query on screen.

Parameters

__namedParameters

UsePickupPointSearchOptions

Returns

UsePickupPointSearchResult

Example

const [city, setCity] = useState('');
const { points, isLoading } = usePickupPointSearch({
provider: method.pickupConfig.provider,
filters: { city },
codOnly: cartIsCashOnDelivery,
});

<input value={city} onChange={(e) => setCity(e.target.value)} />
{points.map((point) => <PointRow key={point.id} point={point} onPick={...} />)}