Fluent Commerce Logo
Docs

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

Step arrow right iconGuide

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.

Step arrow right iconTemplates used in the example:

NameExampleAdditional information
currency`{{ currency 123 'AUD' }}`
add`{{add 1 2}} // 3`
arrayFieldSumcalculation data:

const arr = [{age: 1},{age: 2},{age: 3},]

`{{arrayFieldSum arr 'age'}} // 6`
  • works only in OMS
  • is used to calculate the sum of fields in array items with a given path (path to number in item)

Step arrow right iconReal 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)
Step 1. Get requested data from GraphQL query:Step 2. Configure Manifest as in the example below:

Fluent Commerce

Fluent Commerce