Configure complex calculation in Manifest
How-to Guide
Author:
Fluent Commerce
Changed on:
13 Dec 2023
Key Points
- This article describes how to configure complex calculation in Manifest
- Target audience: Architect, Partner Developer, Partner BA.
Steps
Guide
The general approach for complex numbers calculation in Manifest should be based on the following steps:- Define the calculation formula.
- Get the required data from GraphQL.
- You can use templates combination to describe required formula.
- Extend Manifest.
Templates used in the example:
| Name | Example | Additional information |
| currency | `{{ currency 123 'AUD' }}` | |
| add | `{{add 1 2}} // 3` | |
| arrayFieldSum | calculation data: const arr = [{age: 1},{age: 2},{age: 3},] `{{arrayFieldSum arr 'age'}} // 6` |
|
Real Life Example
We want to display the Order Value card containing the following fields:- Items - the sum of all items' values in the order
- Shipping - shipping fee (the sum of shipping fees of all deliveries in the order)
- Taxes - the sum of order items' taxes
- Total - the sum of values above (Items Subtotal + Shipping + Taxes)