Find
You get the first item of an array with a matching property, or nil when none is found. With one argument, the property must be truthy. With two arguments, the property must be equal to the value.
liquid
{{ array | find: property, value }}Example
Data
json
{
"products": [
{ "title": "Hat", "available": true, "type": "Accessory" },
{ "title": "Tee", "available": false, "type": "Clothing" },
{ "title": "Cap", "available": true, "type": "Accessory" }
]
}liquid
{% assign tee = products | find: 'type', 'Clothing' %}
{{ tee.title }}Output
html
Tee