Cart total
FreeLogic@rabbinatix/cart-total by Rabbinatixupdated Oct 4, 2026
Adds up `price × qty` for every line, and counts the items.
A helper function computes each line total with Map; Sum adds the list, and Sum with an item path (qty) counts the items without a helper.
Shows: Map, Sum (plain and by path), Round.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Cart total. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
items: List of records
Outputs
total: Number
count: Number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 6
Cart total
items
Map, Collection. 1 input, 1 output. step 2 of 6
Map Line total
array
result
Sum, Collection. 1 input, 1 output. step 3 of 6
Sum
array
sum
Round, Math. 2 inputs, 1 output. step 4 of 6
Round
value
decimals
result
Sum, Collection. 1 input, 1 output. step 5 of 6
Sum
array
sum
Return, Input / output. 3 inputs, 0 outputs. step 6 of 6
Return
total
count
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 2/2 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| Two lines | {"items":[{"price":2.5,"qty":2},{"price":1.2,"qty":3}]} | {"total":8.6,"count":5} | |
| Empty cart | {"items":[]} | {"total":0,"count":0} |
Try it
Versions
In this package
Cart total (entry)
Line total
