> For the complete documentation index, see [llms.txt](https://docs.fact-finder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fact-finder.com/webcomponents-overview/api/more-features/similar-products.md).

# Similar Products

\`ff-similar-products\` retrieves products related to a specified product. Use a nested \`ff-record-list\` to render returned items and limit their count.

## Documentation

### Overview

With the `ff-similar-products` element you can display a list of products which are similar to a specified product.

Inside the `ff-similar-products` element you define an `ff-record-list` to display the similar products.

```html
<ff-similar-products>
    <div class="similarProductsHeader">Similar Products</div>

    <ff-record-list subscribe="false">
        <template data-role="record">
            <ff-record>
                <img data-image>
                <div>
                    <a href="https://your.shop/{{variantValues.0.Deeplink}}">
                        {{variantValues.0.Title}}
                    </a>
                    <div>Price: <strong>{{$ variantValues.0.Price}}</strong></div>
                </div>
            </ff-record>
        </template>
    </ff-record-list>
</ff-similar-products>
```

## API

### `ff-similar-products`

#### Properties

*(`*` - required)*

| Name                                                       | Description                                      |
| ---------------------------------------------------------- | ------------------------------------------------ |
| **product-id**`*` (String)                                 | The product ID used to return similar products.  |
| **id-type**`*` (String) **Options**: "id", "productNumber" | Determines the type of `product-id`.             |
| **max-results** (Number) (default: empty)                  | The maximum number of returned similar products. |

#### Methods

| Name                     | Description                                                      |
| ------------------------ | ---------------------------------------------------------------- |
| **getSimilarProducts()** | Refreshes similar products using the current `product-id` value. |

### Attributes

#### product-id and id-type

When the `product-id` attribute is set, and every time it changes, `ff-similar-products` queries the FactFinder API for products similar to the one specified.

The `id-type` attribute defines what type of ID `product-id` specifies. There are two possible values:

* `productNumber`
* `id`

Both attributes are required in order to invoke a valid request to FactFinder.

```html
<ff-similar-products product-id="123456789" id-type="productNumber">
    <!-- ... -->
</ff-similar-products>
```

```js
const similarProductsElement = document.querySelector(`ff-similar-products`);
similarProductsElement.idType = `id`;
similarProductsElement.productId = `567891234`;
```

#### max-results

The `max-results` attribute defines how many records the FactFinder API shall return at most. The default value is empty and the FactFinder API will return as many records as its own default value is set to.

```html
<ff-similar-products max-results="4">
   <!-- ... -->
</ff-similar-products>
```


---

# 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.fact-finder.com/webcomponents-overview/api/more-features/similar-products.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.
