How do you calculate a cart total from line items in Adalo?
Store quantity-times-price on each cart line, relate lines to the current cart, and display the Sum of the related line totals.
Create one cart line record per product, save its Line Total as Current Product Price multiplied by Quantity, and display the Sum of Line Total across the current cart’s related lines.
Calculate each line subtotal in its own record, then aggregate those related records from the cart context. This separates per-item math from the collection-level Sum and makes incorrect relationship context easier to diagnose.
The intended outcome
The cart total updates from saved line-item subtotals instead of reading only one product price.
Requirements
- Products with a numeric Price
- A Cart or Order record
- Related Cart Line records
- A numeric Quantity and Line Total on each line
Step by step
- 01
Create cart line records
Use a Cart Lines collection related many-to-one to the current Cart and related to the selected Product.
- 02
Save quantity and line total
When adding a product, save Quantity and calculate Line Total as Current Product Price multiplied by Quantity.
- 03
Aggregate the cart
In the cart-total text, select Current Cart’s Cart Lines, choose Line Total, and use Sum.
- 04
Update edited quantities
Whenever Quantity changes, recalculate that line’s Line Total before displaying the aggregate.
The underlying logic
A formula in one product context can only calculate that line; the cart needs an aggregation across related records.
Persisting Line Total makes the Sum straightforward, but it must remain synchronized with price and quantity.
Data model
| Collection | Important properties | Relationships |
|---|---|---|
What still needs checking?
- This is a forum-native answer with no original Adalocado video.
- Current Adalo documentation directly supports Sum aggregation over a related collection and custom math formulas.
Common failure modes
The total shows one product only
Start Magic Text from Current Cart’s related Cart Lines and choose Line Total → Sum, not Current Product Price.
The total is stale after changing quantity
Update the line record’s Quantity and Line Total in the same workflow, then refresh or revisit the cart data.
A line is counted in the wrong cart
Inspect the Cart relationship on every line and ensure Add to Cart uses the current active Cart.
Testing checklist
0 of 6 checked on this device
Current limitations
- Stored line totals can drift if update actions do not recalculate them.
- For historical orders, consider snapshotting the purchase price so later Product price changes do not rewrite past totals.
Current evidence screenshots have not yet been added. Treat the guidance as documented or legacy material according to the status shown above.
What the Adalo community is reporting
These are concise editorial summaries of public forum posts—not endorsements or independently reproduced results.
How to sum a value in list data
Store price multiplied by quantity on related cart-order records, then Sum their Total Price; the original poster confirmed it worked.
Boundary: The source used project-specific collection names and mentioned additional workarounds without detailing them.
Ali-Bazzi (accepted answer) · September 2024Sources and status
This page was last reviewed on Aug 16, 2026. Its current status is Documented from current sources.
Verification owner: Automatically organized from an accepted forum answer; monitored for corrections. Next review: Oct 16, 2026.
Changelog
Automatically posted from a solved Adalo forum topic; corrections are monitored on the live site.
Report this answer.
Forum answers post automatically. If a step is wrong, outdated, unclear, or missing an important boundary, send the exact correction and the editor will check the live page.
Report a problemDid this solve your problem?
Never deal with an Adalo problem again.
Rehost becomes the monthly team behind your app. Fixes, releases, integrations, and ongoing changes have an owner.
See monthly managementBring us the messy version.
Describe what you expected, what happened instead, and what you already tried.
Ask Adalocado 💬
