Shipping Option Hooks - Admin Components
The shipping option hooks retrieve shipping options from the Medusa backend, either a single option by ID or a paginated list.
These hooks are built on TanStack Query. Use them in your widgets and UI routes.
useShippingOption#
Retrieve a single shipping option by its ID. Pass a query object as the second parameter to select the fields and relations to retrieve.
Parameters#
Returns#
Along with the following, the hook returns the rest of TanStack Query's useQuery result.
useShippingOptions#
Retrieve a paginated list of shipping options. Pass query parameters to filter the shipping options, for example by stock location or shipping profile.
Parameters#
Returns#
Along with the following, the hook returns the rest of TanStack Query's useQuery result.
shippingOptionsQueryKeys#
shippingOptionsQueryKeys is the query key factory for shipping option queries. Use all, lists(), list(query), details(), and detail(id) to build the keys that the hooks above register.
Use it to invalidate cached shipping option data after a custom mutation: