• When you use the URL template below, the server returns a category identified by its ID; by default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. The server only returns online categories.

    Parameter

    apiOptions - Options to pass through to commerce-sdk-isomorphic, with null accepted for unset API parameters.

    Parameter

    queryOptions - TanStack Query query options, with enabled by default set to check that all required API parameters have been set.

    See

    Parameters

    • apiOptions: NullableParameters<{
          headers?: {
              [key: string]: string;
          };
          parameters: { id: string; levels?: number | undefined; organizationId?: string | undefined; locale?: string | undefined; siteId?: string | undefined; };
      }>
    • queryOptions: ApiQueryOptions<{
          (options?): Promise<Category>;
          <T>(options?, rawResponse?): Promise<T extends true
              ? Response
              : Category>;
      }> = {}

    Returns UseQueryResult<Category, unknown>

    A TanStack Query query hook with data from the Shopper Products getCategory endpoint.