Where
Returns the items of an array that match a condition. With one argument, the filter keeps the items whose property is truthy. With two arguments, it keeps the items whose property equals the value.
liquid
{{ array | where: 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
{{ products | where: 'available' | map: 'title' | join: ', ' }}
{{ products | where: 'type', 'Clothing' | map: 'title' | join: ', ' }}Output
html
Hat, Cap
Tee