Skip to main content

find

array | find: string, string

Returns the first item in an array with a specific property value.

This requires you to provide both the property name and the associated value.

{% assign product = collection.products | find: 'vendor', "Polina's Potent Potions" %}

{{ product.title }}

Output

Blue Mountain Flower
Anchor to Returns `nil` when no items match the specified property value.

Returns nil when no items match the specified property value.

{% assign product = collection.products | find: 'vendor', "Polina's Potions" %}

{{ product.title | default: "No product found" }}

Output

No product found
Was this page helpful?