Help with Item List

Describe the issue/error/question

I am trying to use the Item List Node to aggregate data that I am getting from a WooCommerce Order by customer lookup.

The resulting data gives me all the orders for a specific customer.
I would like to be able to do the following:

  1. Count the number of orders for the specific customer
  2. Get the total value of orders for the specific customer and sum this together.

My first approach was to see if i can extract just the totals fro the JSON results by using Item List Aggregate.

I was hoping that it would return all the โ€œtotalsโ€ from the JSON, however I am getting the error message that it cannot find the field total in the input data.

Information on your n8n setup

  • n8n version: 0.207.0
  • Database youโ€™re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Surge.Media, I am very sorry to hear youโ€™re having trouble. I just gave this a go on my end using the below test workflow but didnโ€™t have trouble (on neither [email protected] nor the current version 0.209.4):

The aggregation is working as expected:

Is there a chance your Item Lists node has more than once incoming branch? Could you perhaps share a workflow using which your problem can be reproduced?

Hi @MutedJam - thank you for the quick reply.

The workflow has only one incoming branch, it is an HTTP node where I am making the request and then the item list node.

I am going to just paste the JSON output here as not sure how to make mockup data from it, it is very long thoughโ€ฆ

Appreciate the assistance here

{
  "id": 99999,
  "parent_id": 0,
  "status": "completed",
  "currency": "ILS",
  "version": "6.7.0",
  "prices_include_tax": false,
  "date_created": "2022-11-08T08:29:39",
  "date_modified": "2022-11-09T19:59:28",
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "24.90",
  "shipping_tax": "0.00",
  "cart_tax": "0.00",
  "total": "228.47",
  "total_tax": "0.00",
  "customer_id": 81,
  "order_key": "wc_order_bi3qaIuwfcA0b",
  "billing": {
    "first_name": "firstname",
    "last_name": "lastname",
    "company": "",
    "address_1": "",
    "address_2": "",
    "city": "",
    "state": "",
    "postcode": "",
    "country": "",
    "email": "[email protected]",
    "phone": "99999999"
  },
  "shipping": {
    "first_name": "",
    "last_name": "",
    "company": "",
    "address_1": "",
    "address_2": "",
    "city": "",
    "state": "",
    "postcode": "",
    "country": "IL",
    "phone": ""
  },
  "payment_method": "checkout_payment",
  "payment_method_title": "ืชืฉืœื•ื ืžืื•ื‘ื˜ื— ื‘ื›ืจื˜ื™ืก ืืฉืจืื™",
  "transaction_id": "",
  "customer_ip_address": "46.31.102.2",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
  "created_via": "checkout",
  "customer_note": "",
  "date_completed": "2022-11-09T19:59:28",
  "date_paid": "2022-11-09T19:59:28",
  "cart_hash": "27d633ebc2d2a3e38c5d7e49b81d6ea5",
  "number": "99999",
  "meta_data": [
    {
      "id": 77056,
      "key": "_billing_extra_phone",
      "value": ""
    },
    {
      "id": 77057,
      "key": "_billing_house_number",
      "value": "14"
    },
    {
      "id": 77058,
      "key": "_billing_apartment",
      "value": "2"
    },
    {
      "id": 77059,
      "key": "_billing_level",
      "value": "1"
    },
    {
      "id": 77060,
      "key": "_billing_code",
      "value": "2022"
    },
    {
      "id": 77061,
      "key": "_billing_is_home",
      "value": [
        ""
      ]
    },
    {
      "id": 77062,
      "key": "_billing_delivery_type",
      "value": [
        "ืžืฉืœื•ื— ืืงื•ืœื•ื’ื™ (ืœืœื ืฉืงื™ื•ืช)"
      ]
    },
    {
      "id": 77063,
      "key": "_billing_get_mail",
      "value": ""
    },
    {
      "id": 77064,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 77065,
      "key": "ywcdd_order_delivery_date",
      "value": "2022-11-09"
    },
    {
      "id": 77066,
      "key": "ywcdd_order_shipping_date",
      "value": "2022-11-09"
    },
    {
      "id": 77067,
      "key": "ywcdd_order_slot_from",
      "value": "15:00"
    },
    {
      "id": 77068,
      "key": "ywcdd_order_slot_to",
      "value": "19:00"
    },
    {
      "id": 77069,
      "key": "ywcdd_order_carrier_id",
      "value": "31016"
    },
    {
      "id": 77070,
      "key": "ywcdd_order_processing_method",
      "value": "30635"
    },
    {
      "id": 77071,
      "key": "ywcdd_order_carrier",
      "value": "ื’ื‘ืขืชื™ื™ื"
    },
    {
      "id": 77072,
      "key": "yaad_query_string",
      "value": "Amount=228.47&BOF=True&ClientLName=Waissengrin&ClientName=firstname&Coin=1&Info=%D7%94%D7%96%D7%9E%D7%A0%D7%94%2099999&J5=True&Masof=4501287940&MoreData=True&Order=99999&PageLang=HEB&SendHesh=True&Sign=True&Tash=2&UTF8=True&UserId=L99999&action=pay&cell=0542662201&city=N%2FA&email=firstname28%40gmail.com&sendHeshSMS=True&sendemail=False&street=%D7%99%D7%A6%D7%97%D7%A7%20&tmp=6&zip=&signature=16be8c44aabfcc1167ac31c50160208c631732eacdb15032db06880ce68c399d"
    },
    {
      "id": 77073,
      "key": "billing_house_number",
      "value": "14"
    },
    {
      "id": 77074,
      "key": "billing_apartment",
      "value": "2"
    },
    {
      "id": 77075,
      "key": "billing_level",
      "value": "1"
    },
    {
      "id": 77076,
      "key": "billing_code",
      "value": "2022"
    },
    {
      "id": 77077,
      "key": "billing_is_home",
      "value": "ืœื”ืฉืื™ืจ ืœื™ื“ ื”ื“ืœืช"
    },
    {
      "id": 77078,
      "key": "billing_delivery_type",
      "value": "ืžืฉืœื•ื— ืืงื•ืœื•ื’ื™ (ืœืœื ืฉืงื™ื•ืช)"
    },
    {
      "id": 77079,
      "key": "order_guid",
      "value": "38f43be0cf9f5931a6df3e08c92992800a6aeb7aa18617e93246f7d4ef9d26af"
    },
    {
      "id": 77080,
      "key": "zc_payment_token",
      "value": ""
    },
    {
      "id": 77081,
      "key": "zc_transaction_id",
      "value": ""
    },
    {
      "id": 77082,
      "key": "zc_response",
      "value": ""
    },
    {
      "id": 77086,
      "key": "_linet_doc_id",
      "value": "396"
    },
    {
      "id": 77087,
      "key": "_linet_docnum",
      "value": "80213"
    },
    {
      "id": 77088,
      "key": "_linet_invoice_id",
      "value": "396"
    },
    {
      "id": 77089,
      "key": "_linet_currency_rate",
      "value": "1"
    },
    {
      "id": 77090,
      "key": "_new_order_email_sent",
      "value": "true"
    },
    {
      "id": 77091,
      "key": "_linet_doc_url",
      "value": ""
    },
    {
      "id": 81600,
      "key": "_pip_invoice_number",
      "value": "99999"
    }
  ],
  "line_items": [
    {
      "id": 4786,
      "name": "ื—ืกื” ืœื‘ื‘ื•ืช ืงื™ืกืจ",
      "product_id": 32031,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "11.90",
      "subtotal_tax": "0.00",
      "total": "11.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "13596",
      "price": 11.9,
      "image": {
        "id": "32724",
        "src": "https://woocommercewebsite/wp-content/uploads/images/fbf23dc8-d68c-11ec-aaf8-3e6b1462f023.png"
      },
      "parent_name": null
    },
    {
      "id": 4787,
      "name": "ืžื ื’ื•ืœื“ ืฉืœ ืจืžื™ ืงื ื˜ื•ืจ",
      "product_id": 31977,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "8.90",
      "subtotal_tax": "0.00",
      "total": "8.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "14519",
      "price": 8.9,
      "image": {
        "id": "32688",
        "src": "https://woocommercewebsite/wp-content/uploads/images/ce983008-d68c-11ec-ae91-b257dcb77624.png"
      },
      "parent_name": null
    },
    {
      "id": 4788,
      "name": "ืชืื ื™ื",
      "product_id": 31752,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "15.90",
      "subtotal_tax": "0.00",
      "total": "15.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "19341",
      "price": 15.9,
      "image": {
        "id": "32578",
        "src": "https://woocommercewebsite/wp-content/uploads/images/26ee61a6-d68c-11ec-b409-3e6b1462f023.png"
      },
      "parent_name": null
    },
    {
      "id": 4789,
      "name": "ืคื•ืžืœื”",
      "product_id": 31907,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "16.90",
      "subtotal_tax": "0.00",
      "total": "16.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "15439",
      "price": 16.9,
      "image": {
        "id": "33820",
        "src": "https://woocommercewebsite/wp-content/uploads/images/2ff2386c-6373-11ed-863b-6e87809e69be.png"
      },
      "parent_name": null
    },
    {
      "id": 4790,
      "name": "ื‘ื ื ื”",
      "product_id": 32123,
      "variation_id": 32514,
      "quantity": 4,
      "tax_class": "",
      "subtotal": "10.46",
      "subtotal_tax": "0.00",
      "total": "10.46",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43674,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "13578-unit",
      "price": 2.616,
      "image": {
        "id": 32779,
        "src": "https://woocommercewebsite/wp-content/uploads/images/444a9cdc-d68d-11ec-bec6-9e486f8e850c.png"
      },
      "parent_name": "ื‘ื ื ื”"
    },
    {
      "id": 4791,
      "name": "ืชืคื•ื— ืขืฅ ืคื™ื ืง ืœื™ื™ื“ื™",
      "product_id": 31712,
      "variation_id": 31713,
      "quantity": 2,
      "tax_class": "",
      "subtotal": "7.18",
      "subtotal_tax": "0.00",
      "total": "7.18",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43684,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "21030-unit",
      "price": 3.591,
      "image": {
        "id": 32550,
        "src": "https://woocommercewebsite/wp-content/uploads/images/0cd068f0-d68c-11ec-8474-f2b2e252fcea.png"
      },
      "parent_name": "ืชืคื•ื— ืขืฅ ืคื™ื ืง ืœื™ื™ื“ื™"
    },
    {
      "id": 4792,
      "name": "ืชืคื•ื— ืขืฅ ื™ืจื•ืง ื’ืจื ื™ ืกืžื™ืช",
      "product_id": 31715,
      "variation_id": 31716,
      "quantity": 3,
      "tax_class": "",
      "subtotal": "10.20",
      "subtotal_tax": "0.00",
      "total": "10.20",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43694,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "15451-unit",
      "price": 3.401,
      "image": {
        "id": 32564,
        "src": "https://woocommercewebsite/wp-content/uploads/images/0e0d6b3c-d68c-11ec-9704-3e6b1462f023.png"
      },
      "parent_name": "ืชืคื•ื— ืขืฅ ื™ืจื•ืง ื’ืจื ื™ ืกืžื™ืช"
    },
    {
      "id": 4793,
      "name": "ืขื’ื‘ื ื™ื™ืช ืชืžืจ",
      "product_id": 31918,
      "variation_id": 31919,
      "quantity": 5,
      "tax_class": "",
      "subtotal": "7.65",
      "subtotal_tax": "0.00",
      "total": "7.65",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43704,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "13606-unit",
      "price": 1.529,
      "image": {
        "id": 32652,
        "src": "https://woocommercewebsite/wp-content/uploads/images/9fb946b4-d68c-11ec-b042-f2b2e252fcea.png"
      },
      "parent_name": "ืขื’ื‘ื ื™ื™ืช ืชืžืจ"
    },
    {
      "id": 4794,
      "name": "ืขื’ื‘ื ื™ื•ืช ืฉืจื™ ืžื™ืงืก",
      "product_id": 32003,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "24.90",
      "subtotal_tax": "0.00",
      "total": "24.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "23633",
      "price": 24.9,
      "image": {
        "id": "32706",
        "src": "https://woocommercewebsite/wp-content/uploads/images/e3755870-d68c-11ec-88b6-2e3f74216eb1.png"
      },
      "parent_name": null
    },
    {
      "id": 4795,
      "name": "ืžืœืคืคื•ืŸ ืžื•ื‘ื—ืจ",
      "product_id": 31986,
      "variation_id": 32457,
      "quantity": 2,
      "tax_class": "",
      "subtotal": "19.80",
      "subtotal_tax": "0.00",
      "total": "19.80",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43723,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ืงื’",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ืงื’"
        }
      ],
      "sku": "13600-kg",
      "price": 9.9,
      "image": {
        "id": 32694,
        "src": "https://woocommercewebsite/wp-content/uploads/images/d61b7006-d68c-11ec-9f85-2e3f74216eb1.png"
      },
      "parent_name": "ืžืœืคืคื•ืŸ ืžื•ื‘ื—ืจ"
    },
    {
      "id": 4796,
      "name": "ืงื™ืฉื•ื",
      "product_id": 31823,
      "variation_id": 31824,
      "quantity": 3,
      "tax_class": "",
      "subtotal": "7.63",
      "subtotal_tax": "0.00",
      "total": "7.63",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43733,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "13618-unit",
      "price": 2.544,
      "image": {
        "id": 32610,
        "src": "https://woocommercewebsite/wp-content/uploads/images/5a7f0b88-d68c-11ec-bcf1-b257dcb77624.png"
      },
      "parent_name": "ืงื™ืฉื•ื"
    },
    {
      "id": 4797,
      "name": "ื‘ืฆืœ ืœื‘ืŸ ื™ื‘ืฉ",
      "product_id": 32119,
      "variation_id": 32510,
      "quantity": 2,
      "tax_class": "",
      "subtotal": "11.80",
      "subtotal_tax": "0.00",
      "total": "11.80",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43743,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ืงื’",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ืงื’"
        }
      ],
      "sku": "13580-kg",
      "price": 5.9,
      "image": {
        "id": 32777,
        "src": "https://woocommercewebsite/wp-content/uploads/images/417d2ed4-d68d-11ec-814d-9e486f8e850c.png"
      },
      "parent_name": "ื‘ืฆืœ ืœื‘ืŸ ื™ื‘ืฉ"
    },
    {
      "id": 4798,
      "name": "ื‘ืฆืœ ืกื’ื•ืœ",
      "product_id": 32116,
      "variation_id": 32508,
      "quantity": 2,
      "tax_class": "",
      "subtotal": "3.76",
      "subtotal_tax": "0.00",
      "total": "3.76",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43753,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "19152-unit",
      "price": 1.881,
      "image": {
        "id": 32776,
        "src": "https://woocommercewebsite/wp-content/uploads/images/4001567a-d68d-11ec-a20d-f2b2e252fcea.png"
      },
      "parent_name": "ื‘ืฆืœ ืกื’ื•ืœ"
    },
    {
      "id": 4799,
      "name": "ื‘ืฆืœ ื™ืจื•ืง",
      "product_id": 32122,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "6.90",
      "subtotal_tax": "0.00",
      "total": "6.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "13579",
      "price": 6.9,
      "image": {
        "id": "33102",
        "src": "https://woocommercewebsite/wp-content/uploads/images/d867927c-56a7-11ed-a7b4-b275f2447848.png"
      },
      "parent_name": null
    },
    {
      "id": 4800,
      "name": "ืœื™ืžื•ืŸ ืžืื™ื™ืจ ืžืœื ื‘ืžื™ืฅ",
      "product_id": 32810,
      "variation_id": 33245,
      "quantity": 2,
      "tax_class": "",
      "subtotal": "4.73",
      "subtotal_tax": "0.00",
      "total": "4.73",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43772,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "34311-unit",
      "price": 2.363,
      "image": {
        "id": 32811,
        "src": "https://woocommercewebsite/wp-content/uploads/images/20a141d2-3a8d-11ed-8ad2-fa2296893979.png"
      },
      "parent_name": "ืœื™ืžื•ืŸ ืžืื™ื™ืจ ืžืœื ื‘ืžื™ืฅ"
    },
    {
      "id": 4801,
      "name": "ื—ืฆื™ืœ ื—ืžืžื” (ื™ื—ืณ)",
      "product_id": 31850,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "3.71",
      "subtotal_tax": "0.00",
      "total": "3.71",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43782,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "13614",
      "price": 3.713,
      "image": {
        "id": "32812",
        "src": "https://woocommercewebsite/wp-content/uploads/images/70cc14d4-3a8d-11ed-9041-fa2296893979.png"
      },
      "parent_name": null
    },
    {
      "id": 4802,
      "name": "ื›ืจื•ื‘ื™ืช (ื™ื—ืณ)",
      "product_id": 32034,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "15.90",
      "subtotal_tax": "0.00",
      "total": "15.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "13594",
      "price": 15.9,
      "image": {
        "id": "32726",
        "src": "https://woocommercewebsite/wp-content/uploads/images/ff9554e2-d68c-11ec-b1aa-2e3f74216eb1.png"
      },
      "parent_name": null
    },
    {
      "id": 4803,
      "name": "ื“ืœืขืช ืณืกื‘ื ื ื—ื•ืืณ",
      "product_id": 32079,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "7.45",
      "subtotal_tax": "0.00",
      "total": "7.45",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43801,
          "key": "pa_ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "value": "ื™ื—ื™ื“ื”",
          "display_key": "ื™ื—ื™ื“ื•ืช-ืงื™ืœื•",
          "display_value": "ื™ื—ื™ื“ื”"
        }
      ],
      "sku": "20456",
      "price": 7.45,
      "image": {
        "id": "32757",
        "src": "https://woocommercewebsite/wp-content/uploads/images/73ee1152-2f62-11ed-aedd-fe0cf1d34c29.png"
      },
      "parent_name": null
    },
    {
      "id": 4804,
      "name": "ื ื‘ื˜ื™ื ืกื™ื ื™ื",
      "product_id": 31963,
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal": "7.90",
      "subtotal_tax": "0.00",
      "total": "7.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [],
      "sku": "21867",
      "price": 7.9,
      "image": {
        "id": "33107",
        "src": "https://woocommercewebsite/wp-content/uploads/images/9adb5726-56a8-11ed-a1a1-b67c6ffeea78.png"
      },
      "parent_name": null
    }
  ],
  "tax_lines": [],
  "shipping_lines": [
    {
      "id": 4805,
      "method_title": "ืžืฉืœื•ื—",
      "method_id": "flat_rate",
      "instance_id": "1",
      "total": "24.90",
      "total_tax": "0.00",
      "taxes": [],
      "meta_data": [
        {
          "id": 43816,
          "key": "ื—ืคืฆื™ื",
          "value": "ื—ืกื” ืœื‘ื‘ื•ืช ืงื™ืกืจ × 1, ืžื ื’ื•ืœื“ ืฉืœ ืจืžื™ ืงื ื˜ื•ืจ × 1, ืชืื ื™ื × 1, ืคื•ืžืœื” × 1, ื‘ื ื ื” × 4, ืชืคื•ื— ืขืฅ ืคื™ื ืง ืœื™ื™ื“ื™ × 2, ืชืคื•ื— ืขืฅ ื™ืจื•ืง ื’ืจื ื™ ืกืžื™ืช × 3, ืขื’ื‘ื ื™ื™ืช ืชืžืจ × 5, ืขื’ื‘ื ื™ื•ืช ืฉืจื™ ืžื™ืงืก × 1, ืžืœืคืคื•ืŸ ืžื•ื‘ื—ืจ × 2, ืงื™ืฉื•ื × 3, ื‘ืฆืœ ืœื‘ืŸ ื™ื‘ืฉ × 2, ื‘ืฆืœ ืกื’ื•ืœ × 2, ื‘ืฆืœ ื™ืจื•ืง × 1, ืœื™ืžื•ืŸ ืžืื™ื™ืจ ืžืœื ื‘ืžื™ืฅ × 2, ื—ืฆื™ืœ ื—ืžืžื” (ื™ื—ืณ) × 1, ื›ืจื•ื‘ื™ืช (ื™ื—ืณ) × 1, ื“ืœืขืช ืณืกื‘ื ื ื—ื•ืืณ × 1, ื ื‘ื˜ื™ื ืกื™ื ื™ื × 1",
          "display_key": "ื—ืคืฆื™ื",
          "display_value": "ื—ืกื” ืœื‘ื‘ื•ืช ืงื™ืกืจ × 1, ืžื ื’ื•ืœื“ ืฉืœ ืจืžื™ ืงื ื˜ื•ืจ × 1, ืชืื ื™ื × 1, ืคื•ืžืœื” × 1, ื‘ื ื ื” × 4, ืชืคื•ื— ืขืฅ ืคื™ื ืง ืœื™ื™ื“ื™ × 2, ืชืคื•ื— ืขืฅ ื™ืจื•ืง ื’ืจื ื™ ืกืžื™ืช × 3, ืขื’ื‘ื ื™ื™ืช ืชืžืจ × 5, ืขื’ื‘ื ื™ื•ืช ืฉืจื™ ืžื™ืงืก × 1, ืžืœืคืคื•ืŸ ืžื•ื‘ื—ืจ × 2, ืงื™ืฉื•ื × 3, ื‘ืฆืœ ืœื‘ืŸ ื™ื‘ืฉ × 2, ื‘ืฆืœ ืกื’ื•ืœ × 2, ื‘ืฆืœ ื™ืจื•ืง × 1, ืœื™ืžื•ืŸ ืžืื™ื™ืจ ืžืœื ื‘ืžื™ืฅ × 2, ื—ืฆื™ืœ ื—ืžืžื” (ื™ื—ืณ) × 1, ื›ืจื•ื‘ื™ืช (ื™ื—ืณ) × 1, ื“ืœืขืช ืณืกื‘ื ื ื—ื•ืืณ × 1, ื ื‘ื˜ื™ื ืกื™ื ื™ื × 1"
        }
      ]
    }
  ],
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "payment_url": "https://woocommercewebsite/checkout/order-pay/99999/?pay_for_order=true&key=wc_order_bi3qaIuwfcA0b",
  "is_editable": false,
  "needs_payment": false,
  "needs_processing": true,
  "date_created_gmt": "2022-11-08T05:29:39",
  "date_modified_gmt": "2022-11-09T16:59:28",
  "date_completed_gmt": "2022-11-09T16:59:28",
  "date_paid_gmt": "2022-11-09T16:59:28",
  "gift_cards": [],
  "currency_symbol": "โ‚ช",
  "_links": {
    "self": [
      {
        "href": "https://woocommercewebsite/wp-json/wc/v3/orders/99999"
      }
    ],
    "collection": [
      {
        "href": "https://woocommercewebsite/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://woocommercewebsite/wp-json/wc/v3/customers/81"
      }
    ]
  }
}

Hi @Surge.Media, so you only have a single item in n8n? I am not 100% sure which calculation you want to perform on this as it already has a total field that appears to be equal the sum of the total values for each item in the line_items array plus shipping_total.

Can you confirm how to determine the metrics you want to see (number of orders for the specific customer, total value of orders for the specific customer) based on the data you have provided?

If you want to count the line items or calculate the total without shipping this could be achieved like so for example:

@MutedJam thank you! Your mock data and set work perfectly. Exactly what I am looking for, however if i take your โ€œSet nodeโ€ and add it to my current workflow it still does not work. I tried maybe changing the expression to something like this, where HTTP Request1 is my starting node.
{{ $node[โ€œHTTP Request1โ€].json.line_items.length }}. This did not work either, then i tried {{ $node[โ€œHTTP Request1โ€].line_items.length }} and also did not workโ€ฆ So i know i am missing something in my understanding

Once again appreciate the time and effort on this.

I am so sorry youโ€™re still having trouble @Surge.Media. I just tried this example using an HTTP Request node and itโ€™s still working fine for me:

This is my result:

On your screenshot at least the total and the shipping_total values are present so I am genuinely puzzled what might be the problem here. I wonder if you might be using an older version of the HTTP Request node doing something unexpected here. If you remove your existing HTTP Request node and add a fresh one instead (make sure itโ€™s actually new, donโ€™t just copy an old one), does the behaviour persist for you?

That was it, I was obviously copying an old HTTP node all the time.
Now when I run the same GET with the new HTTP node i actually get 3 items. I am also able to now use ITEM node to aggregate as well.

and if i run your set, i get seperate values now.

Amazing thank you. I guess now i need to go and figure out how to sum totals and count number of orders :-). But i am very happy!!

1 Like

Sweet, glad to hear you managed to get your total array now. Summing up these individual values from your screenshot should work like so:

I am using the JMESPath library built into n8n here. It supports calculating sums and converting strings into numbers. This is the result:

Hope this helps. Let me know if you have any questions on this!

1 Like

Thank you so much @MutedJam - it is always so exciting when you get the answer to these issues!

1 Like

I am now trying to count the number of purchases - trying to use the similar example you provided before, once again I am stuck :man_shrugging:

Based on your mock data I think you just need to remove .line_items from your expression (as there is no line_items property) and use {{ $json["total"].length }} instead, like so:

Perfect :sparkler:
Thank you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.