Author:
Fluent Commerce
Changed on:
13 Dec 2023
The general approach for complex numbers calculation in Manifest should be based on the following steps:
Name | Example | Additional information |
currency |
| |
add |
| |
calculation data:
|
|
We want to display the Order Value card containing the following fields:
Step 1. Get requested data from GraphQL query:
1query (
2 $id: ID!
3 $items_after: String
4 $items_first: Int
5 $fulfilmentChoices_first: Int
6) {
7 orderById(id: $id) {
8 id
9 items(after: $items_after, first: $items_first) {
10 edges {
11 node {
12 id
13 price
14 quantity
15 totalPrice
16 totalTaxPrice
17 taxPrice
18 currency
19 }
20 }
21 }
22 fulfilmentChoices(first: $fulfilmentChoices_first) {
23 edges {
24 node {
25 id
26 fulfilmentPrice
27 currency
28 }
29 }
30 }
31 }
32}
Language: graphqlschema
Name: GraphQL query
Description:
[Warning: empty required content area]Step 2. Configure Manifest as in the example below:
1{
2 "component": "fc.card.attribute",
3 "props": {
4 "title": "Title",
5 "width": "half",
6 "dataSource": "orderById",
7 "attributes": [
8 {
9 "label": "Items",
10 "template": "{{currency (arrayFieldSum items.edges 'node.totalPrice') items.edges.0.node.currency}}"
11 },
12 {
13 "label": "Shipping",
14 "template": "{{currency (arrayFieldSum fulfilmentChoices.edges 'node.fulfilmentPrice') fulfilmentChoices.edges.0.node.currency}}"
15 },
16 {
17 "label": "Taxes",
18 "template": "{{currency (arrayFieldSum items.edges 'node.totalTaxPrice') items.edges.0.node.currency}}"
19 },
20 {
21 "label": "Total",
22 "template": "{{bold (currency (add (arrayFieldSum items.edges 'node.totalPrice') (add (arrayFieldSum fulfilmentChoices.edges 'node.fulfilmentPrice') (arrayFieldSum items.edges 'node.totalTaxPrice'))) items.edges.0.node.currency ) }}"
23 }
24 ]
25 }
26}
Language: json
Name: Configure Manifest
Description:
[Warning: empty required content area]Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.