# $productList->getAttribute()

> Extracts an attribute value from the given element in the collection. This is useful if elements in the collection might be objects, arrays or anything else and you need to get the value independently from that. We use it for `filter`.

- Source: `src/Toolkit/Collection.php#L453` <https://github.com/getkirby/kirby/blob/6.0.0-beta.1/src/Toolkit/Collection.php#L453>
- Inherited from Kirby, not part of the Merx API. See <https://getkirby.com/docs/reference>.

```php
$productList->getAttribute(object|array $item, string $attribute, string|bool $split = false, $related = null)
```

## Parameters

| Name | Type | Default |
| --- | --- | --- |
| `$item` | `object\|array` | `–` |
| `$attribute` | `string` | `–` |
| `$split` | `string\|bool` | `false` |
| `$related` | `–` | `null` |

## Parent class

`Wagnerwagner\Merx\ProductList` inherited from `Kirby\Toolkit\Collection`
