> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# ProductCategoriesService

**Publié le** : 2026-08-20
**Catégorie** : Services

# ProductCategoriesService

Service for reading a site's storefront product category tree.

Accessible via `lynkow.productCategories`. Only categories the merchant made
visible appear, with nesting represented by each node's `children`. Requires a
publishable key: pass `publishableKey` to `createClient(...)` so every request
carries it (commerce routes reject calls without a valid key). Responses are
cached in-memory for 5 minutes (SHORT TTL) when a cache adapter is configured on
the client.

Access via: `lynkow.productCategories`

## Methods

**1** method

### `tree`

```typescript
tree(options?: BaseRequestOptions): Promise<ProductCategoryTreeNode[]>
```

Retrieves the merchant-visible category tree, ordered at every level.
Nesting is represented recursively through `children`; leaves have an empty
array. Cached for 5 minutes.

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `BaseRequestOptions` | Base request options (locale override, custom fetch options). |


Returns: `Promise<ProductCategoryTreeNode[]>`

```typescript
const roots = await lynkow.productCategories.tree()
for (const root of roots) {
  console.log(root.name, root.children.map((child) => child.name))
}
```