Store Hooks - Admin Components
Note: These hooks are available since Medusa v2.21.0.
The store hooks retrieve the active store from the Medusa backend, including its supported currencies and default sales channel.
These hooks are built on TanStack Query. Use them in your widgets and UI routes.
useStore#
Retrieve the active store. The hook lists the stores and returns the first one, so it doesn't accept an ID.
Parameters#
Loading...
Warning: The request throws a error when the Medusa backend has no store.
Returns#
Along with the following, the hook returns the rest of TanStack Query's useQuery result.
Loading...
storeQueryKeys#
storeQueryKeys is the query key factory for store queries. useStore registers its data under storeQueryKeys.details().
Use it to invalidate the cached store after a custom mutation:
Was this page helpful?