---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [cartridges](../index.md) / selectSiteCartridgePath

# Function: selectSiteCartridgePath()

> **selectSiteCartridgePath**\<`T`\>(`sites`, `localNames`, `siteId?`): [`SiteCartridgePathSelection`](../interfaces/SiteCartridgePathSelection.md) & `T` \| `undefined`

Defined in: [packages/b2c-tooling-sdk/src/cartridges/site-paths.ts:111](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/d7ff38c7ca2b1411cd718b9554500c9416f00266/packages/b2c-tooling-sdk/src/cartridges/site-paths.ts#L111)

Picks one site's cartridge path: the requested `siteId` when it is listed,
else the only site, else the site whose path names the most local
cartridges (ties go to the first site ID alphabetically). A `siteId` that
isn't listed (often a default for another project) falls through to the
automatic choice. Business Manager (`Sites-Site`) is never picked
automatically. Returns undefined when nothing matches.

Works on site files from [findSiteCartridgePaths](findSiteCartridgePaths.md) or on any list of
sites and their cartridge paths, such as the sites on an instance.

## Type Parameters

### T

`T` *extends* `object`

## Parameters

### sites

readonly `T`[]

### localNames

readonly `string`[]

### siteId?

`string`

## Returns

[`SiteCartridgePathSelection`](../interfaces/SiteCartridgePathSelection.md) & `T` \| `undefined`
