Skip to main content

Overview

The Store Queries API provides functions for retrieving store information, primarily for authenticated store owners to access their own store data. This is the primary way stores get their profile information for dashboard and management interfaces. Location: convex/stores/queries.ts

Get Store by Authenticated Owner

Retrieves complete store information for the authenticated store owner.

Store Dashboard Hook

Complete React hook for store dashboard data:

Store Status Indicators

Visual indicators for different store states:

Pending Review

Store application submitted and waiting for admin review

Approved

Store is approved and can start selling products

Rejected

Store application rejected with reason provided

Live

Store is live and accepting orders from customers

Store Information Structure

The store query returns comprehensive information:

Get Store Address

Retrieve only the address information for a store with enriched city and area details.
storeId
Id<'stores'>
Optional store ID. If not provided, returns address for authenticated owner’s store.
Returns null if the authenticated user doesn’t have a registered store and no storeId is provided.

Get Store Orders

Retrieve orders for the authenticated store with filtering and pagination support.
status
OrderStatus
Filter orders by status: “pending”, “confirmed”, “preparing”, “ready”, “out_for_delivery”, “delivered”, “cancelled”
limit
number
Maximum number of orders to return (default: 50)

Real-time Updates

The store query automatically updates when store information changes:

Error Handling

Response: nullThis indicates the authenticated user doesn’t have a registered store yet.
Status Code: 401
Status Code: 403

Best Practices

Real-time Updates

Use the React hook pattern to automatically receive updates when store data changes

Status Handling

Always check store status before showing management features

Loading States

Handle loading states gracefully while store data is being fetched

Error Boundaries

Implement proper error handling for missing or inaccessible stores
This query only returns data for the authenticated user’s own store. Store owners cannot access other stores’ private information.
Use the store status to conditionally show different UI components - registration forms for new users, pending status for under review, and full dashboard for approved stores.