> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/connectors/crm-and-fidelity/comarch/extensibility.md).

# Extensibility

Extend Comarch customer and store mapping with connector script hooks.

The default mapping covers the common loyalty fields. Extensibility is useful when a project needs extra Comarch attributes or a different pass payload shape. The complete reference of the Comarch scripts, with their registration, their handlers and worked examples, is the [Comarch scripts](https://docs.thewalletcrew.io/developers-guides/scripting/extensions/comarch) page of the Developers guides.

## Where custom mapping is configured

Custom mapping is configured in the **Advanced** tab of the Comarch settings editor.

<figure><img src="https://3852727835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlP7d71aYydav6e0pRkxc%2Fuploads%2Fzch45FeRTX9Tlv9ytXVg%2Fimage.png?alt=media&#x26;token=c85ee60d-8ba1-43fe-a5fc-0b849631444a" alt="Advanced tab of the Comarch settings editor, showing the script slots used for custom mapping"><figcaption><p>This is where the customer and store mapping scripts are added or reviewed.</p></figcaption></figure>

This is where connector scripts can be added to extend or override the default customer and store mapping.

{% hint style="info" %}
The Wallet Crew support can be contacted when custom mapping needs to be configured or reviewed.
{% endhint %}

## Available hooks

The connector exposes four script hooks.

| Hook                                                   | Purpose                                                                                            | When it runs                                                                                                      |
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `extensions.comarch.customerMapper`                    | Extend or override customer mapping                                                                | After customer data is fetched and the standard mapping is applied                                                |
| `extensions.comarch.locationMapper`                    | Extend or override store mapping                                                                   | After store data is fetched and the standard mapping is applied                                                   |
| `extensions.comarch.walletInstallationCustomerUpdater` | Decide what changes on the Comarch customer when the pass is installed in or removed from a wallet | On every pass installation and removal, while the Comarch setting **update on pass installation change** is on    |
| `extensions.comarch.couponMapper`                      | Adjust, or skip, the benefit each Comarch coupon becomes                                           | For each coupon, at every pass creation and pass metadata update, while the Comarch setting for coupon sync is on |

## When to use extensibility

Use a custom hook when the pass needs data that is not mapped by default.

Common cases include custom profile attributes, loyalty labels, extra location metadata, or project-specific field names.

## What the hooks receive

The customer and store hooks receive the raw Comarch response and the pass entity.

This makes it possible to reuse any field present in the source payload, not only the default mapped fields.

The raw objects are also exposed for inspection under:

* `debug.comarch.customer`
* `debug.comarch.store`

## Recommended approach

Start with the default mapping first.

Then add only the extra fields that the pass really needs. This keeps templates simpler and reduces long-term maintenance.

## Safety notes

Apply mapping changes in staging first.

A mapping script can affect every pass refresh that uses the connector. Validation should cover both data correctness and template rendering.

## FAQ

<details>

<summary><strong>Where is custom Comarch mapping configured?</strong></summary>

Custom mapping is configured in the **Advanced** tab of the Comarch settings editor.

This is where connector scripts can be added to extend or override the default mapping.

</details>

<details>

<summary><strong>When should extensibility be used?</strong></summary>

Extensibility is useful when the default mapping does not cover the project needs.

Common cases include extra Comarch attributes, renamed fields, or project-specific transformation rules.

</details>

<details>

<summary><strong>Can extensibility change both customer and store mapping?</strong></summary>

Yes. Separate hooks are available for customer mapping and store mapping.

This makes it possible to adapt each part independently.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thewalletcrew.io/connectors/crm-and-fidelity/comarch/extensibility.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
