# Template selection

Every Secutix ticket that reaches The Wallet Crew must be rendered with a Wallet Crew template. **Template selection** is the routing logic that chooses that template per ticket.

It becomes useful as soon as one Event Ticket template can’t cover all variants. Think VIP vs standard, season vs single-entry, different barcode formats, or different legal text.

<details>

<summary><strong>Real-world routing examples</strong></summary>

Common reasons to route tickets to different templates:

* **Different product types:** visit pass vs event ticket vs season ticket.
* **Different rooms / halls:** highlight the right room name and entry info.
* **Numbered vs free placement:** show section/row/seat vs “free seating”.
* **Different access experiences:** VIP entrance, early access, staff-only gates.

</details>

## Mapping options

The connector resolves a template name for each ticket. It evaluates the rules below in order. **First match wins.**

#### Resolution order (highest priority first)

1. Pass type finder hook.
2. Secutix comfort variable `WALLET`.
3. Product family subtype mapping.
4. Default template configured for the connector.

Once routing is clear, implement your end-user flows in [Distribution](/connect/ticketing/secutix/distribution.md).

### Pass type finder hook (advanced)

Use this when routing depends on any Secutix field(s). This is a an advanced configuration. Treat it as a last resort and keep it rare because it adds custom logic to maintain. The template engine already supports conditions and variables, which is enough in most cases.

<details>

<summary><strong>Real-world use cases</strong></summary>

Use a hook when routing depends on more than one field:

* **Site / hall** - example: Hall A vs Hall B.
* **Entrance / gate** - different entry instructions.
* **Seat category / zone** - VIP, hospitality, balcony.
* **Performance date/time** - matinee vs evening, special dates.
* **Combined logic** - VIP + a specific date + a specific venue.

</details>

If this hook returns a template name, it overrides `WALLET`, subtype mapping, and the connector default.

Add a custom script in the **Advanced** tab of the Secutix configuration page.

<p align="center"><a href="https://admin.thewalletcrew.io/tenant/~/integrations/secutix/settings" class="button secondary" data-icon="chevrons-right">Secutix configuration screen</a></p>

<details>

<summary><code>passTypeFinder</code> extensibility endpoint</summary>

Register `extensions.secutix.ticket.passTypeFinder` and implement `GetPassType`.

* Return a string to force a template name.
* Return `null` to fall back to default selection.

```javascript
/**
 * Resolves the pass type for a Secutix movement.
 *
 * @async
 * @param {Object} movementData - Movement data within the order.
 * @param {Object|null|undefined} operationData - Optional operation data associated with the movement.
 * @param {Object|null|undefined} product - Optional product details when a product id is available.
 * @returns {Promise<string|null>} The pass type value, or null to let the default resolution apply.
 */
async function getPassType(movementData, operationData, product){
  if(operationData.Site == "Hall A") {
    return "HALLA";
  } else if(operationData.Site == "Hall B") {
    return "HALLB";
  }
  return null;
}

export default function(context) {
  context.register('extensions.secutix.ticket.passTypeFinder', {
    GetPassType : getPassType
  });
}
```

</details>

### `WALLET` comfort variable

Add a Secutix comfort variable on the targeted event named `WALLET` (all caps). Set its value to the **exact Wallet Crew template name**. This value is **case-sensitive**, so `VIP_Template` is not the same as `vip_template`. Avoid leading or trailing spaces.

This is evaluated only if the pass type finder hook returns `null`.

{% hint style="info" %}
Use this when you need a special template for one event. Keep template names stable. Renaming a template can break routing.
{% endhint %}

### Product family subtype mapping

This is the default routing mode when no hook or `WALLET` override is used.

The connector reads the ticket’s **product family subtype**, then translates it into a Wallet Crew template name. You configure the subtype → template mapping once in the Secutix connector settings. That keeps routing stable across events and orders.

You can configure it on the Secutix configuration screen page :

<p align="center"><a href="https://admin.thewalletcrew.io/tenant/~/integrations/secutix/settings" class="button secondary" data-icon="chevrons-right">Secutix configuration screen</a></p>

<div data-with-frame="true"><figure><img src="/files/Tnv3Wrns8whWq7qxlj52" alt="Template selection based on product family subtype." width="563"><figcaption><p>Template selection based on product family subtype.</p></figcaption></figure></div>

### Connector default template

If the hook returns `null`, `WALLET` is not set, and no subtype mapping matches, the connector uses its configured **default template**.

Use this as a safety net. Keep it compatible with “most tickets”.

## Additional information

For a quick refresher on how Wallet Crew templates are structured, start with [Template](/design/general.md#template). When you’re ready to create or adjust the Event Ticket template (and map Secutix fields into it), use [Wallet pass template & field mapping](/connect/ticketing/secutix/wallet-pass-template-and-field-mapping.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thewalletcrew.io/connect/ticketing/secutix/template-selection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
