# CroctOptions

Learn about the resolver options for the Croct middleware and context.

This type describes the options accepted by the [route middleware](/reference/sdk/hydrogen/api/setup/create-croct-middleware) and the [context helper](/reference/sdk/hydrogen/api/setup/create-croct-context).

Both resolvers are optional. When omitted, the SDK reads the logged-in customer from the Shopify [Customer Account API](https://shopify.dev/docs/api/customer) and derives the locale from the storefront's `i18n` configuration.

## Definition

The type has the following shape:

```ts
type CroctOptions = {
  userIdResolver?: UserIdResolver;
  localeResolver?: LocaleResolver;
};
```

## Properties

The following list describes the properties:

- `userIdResolver`: `(context: ResolverContext) => Promise<string | null>` (optional)

  The function that resolves the ID of the logged-in customer for the current request.

  It receives the [Hydrogen request context](/reference/sdk/hydrogen/api/types/resolver-context) and returns the user ID, or nothing for anonymous visitors.

  By default, the SDK reads the logged-in customer's ID from the Shopify Customer Account API.

- `localeResolver`: `(context: ResolverContext) => Promise<string | null>` (optional)

  The function that resolves the preferred content locale for the current request.

  It receives the [Hydrogen request context](/reference/sdk/hydrogen/api/types/resolver-context) and returns a [BCP‑47](https://www.rfc-editor.org/info/bcp47) locale, or nothing to use the workspace default.

  By default, the SDK derives the locale from the storefront's `i18n` configuration, such as `en-US`.
