Skip to content Skip to footer navigation
🏰 Statamic Summit 2027 Feb 16–19 Talks, workshops, and three nights in a German castle. Get Tickets

Sum Modifier

Returns the sum of all items in an array, optionally specified by a specific key.

numbers:
- 5
- 10
- 20
- 40
stats:
- player: Luke Skywalker
score: 750
- player: Wedge Antilles
score: 688
- player: Jar Jar Binks
score: 1425
{{ numbers | sum }}
{{ stats | sum('score') }}
{{ Statamic::modify($numbers)->sum() }}
{{ Statamic::modify($stats)->sum('score') }}
75
2863