except - Liquid Filter Reference - 1.0.0

Filter Name except
Group Arrays
Version 1.0.0

Description

Returns all items in the array where the supplied property does not equal the supplied value

Examples

When both a property and value are supplied, it removes items from the array that match the supplied property and value:
{{ products | except: "type", "whitegoods" | pluck: "name" | join: ", " }}
Geronimo 9000, Y2K Amaze, Elephant
When only a property is supplied, it removes items from the array where the supplied property is a truthy value:
{{ products | except: "new" | pluck: "name" | join: ", " }}
Fridgetastic 3000, Coldinator 500, Geronimo 9000, Elephant
When used in a chain, it is possible to filter out multiple conditions by chaining the filter:
{{ products | except: "type", "whitegoods" | except: "type": "computers" | pluck: "name" | join: ", " }}
Elephant

Back to Filter List

Back to Liquid Reference for 1.0.0

 

 
Back to Documentation