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.

Code
import {
  storeQueryKeys,
  useStore,
} from "@medusajs/dashboard/hooks"

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.

Code
const { store, isPending } = useStore({
  fields: "+supported_currencies.*",
})

Parameters#

Loading...
Warning: The request throws a 404 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:

Code
import { useQueryClient } from "@tanstack/react-query"
import { storeQueryKeys } from "@medusajs/dashboard/hooks"

const queryClient = useQueryClient()

queryClient.invalidateQueries({
  queryKey: storeQueryKeys.details(),
})
Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵