Function: useAvailableShippingMethods()
useAvailableShippingMethods(
__namedParameters):UseAvailableShippingMethodsResult
Delivery methods available for a cart and destination.
The starting point of any delivery step: which methods to show, why none are offered, and how
far the cart is from free shipping. Each method carries deliveryType and — for pickup
methods — pickupConfig, which is what usePickupPointWidget needs to render the carrier map.
Re-fetches whenever the cart or the destination changes, and drops a response that arrives after a newer request has started, so a slow reply for an old address cannot overwrite a fresh one.
Parameters
__namedParameters
UseAvailableShippingMethodsOptions
Returns
UseAvailableShippingMethodsResult
Example
const { methods, userErrors, isLoading } = useAvailableShippingMethods({ cartId, address });
if (isLoading) return <Spinner />;
if (!methods.length) return <p>{userErrors[0]?.message ?? 'Brak metod dostawy'}</p>;
return methods.map((method) => <MethodTile key={method.id} method={method} />);