---
title: "where"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/handlebars/helpers/array/where'
  md: 'https://developer.shopline.com/docs/handlebars/helpers/array/where.md'
---
# where

Filters an array to include only items that possess a specific property value.

This requires providing the property name and the corresponding value.

## Parameters

- `array` `{Array}`: The array to filter. This parameter is required. If the type is incorrect, an empty array is returned.
- `key` `{String}`: The property key to filter by. This parameter is required. If the type is incorrect, an empty array is returned.
- `[value]` `{String}`: The property value to filter by. This parameter is optional and defaults to a truthy evaluation.
- `returns` `{Array}`: The filtered array.

## Usage

```handlebars
{{where array key [value]}}
```

## Example

<Example data={['collection.products.{vendor, title}']}>
  ```handlebars
  {{ assign 'filter_products' (where collection.products 'vendor' "Natural Threads") }}

  Products from Natural Threads:

  {{#each filter_products as |product| }}
    - {{ product.title }}
  {{/each}}
  ```
</Example>

### Filtering Boolean Properties with True Values

You can filter items that have a `true` boolean property value. This requires specifying only the property name.

<Example data={['collection.products.{available, title}']}>
  ```handlebars
  {{ assign 'available_products' (where collection.products 'available') }}

  Available products:

  {{#each available_products as |product| }}
    - {{ product.title }}
  {{/each}}
  ```
</Example>