--- url: https://developer.youcan.shop/themes/filters/arrays/sum.md --- # Sum Returns the sum of the numbers in an array. With a property name, the filter adds the values of this property. Nested arrays are added too. Values that are not numbers count as `0`. ```liquid {{ array | sum: property }} ``` ## Example ::: details Data ```json { "quantities": [ 1, 2, 3.5 ], "products": [ { "title": "Hat", "price": 10 }, { "title": "Tee", "price": 25.5 }, { "title": "Cap", "price": 8 } ] } ``` ::: ```liquid {{ quantities | sum }} {{ products | sum: 'price' }} ``` ::: tip Output ```html 6.5 43.5 ``` :::