Problem workflow connecting Shopify and google sheets

I have some problems building a flow to connect Shopify and Google Sheets.
I want to get my open orders in Shopify and dump them in Google Sheets.
(my current flow is restricted to get 1 order)
So I found several problems trying to accomplish this.

  1. Looping items
    In order to summarize some fields, first I have create a node to loop over items, then I have to split out the field I want to summarize it but it seems only work sequentially I cannot branch a Loop item node and compute 2 summarize nodes at same time.
    I guess I have to summarize one field and then summarize another field, in my flow I am not doing after the first split out node because I have to make other calculations.
    I have to summarize several fields Shopify return as arrays.

  2. Problem trying to check if an array field is Empty
    Shopify API don’t always returns an array for those fields I need to summarize.
    So I am trying to check if array is Empty, but n8n returns type incorrect error ???
    So how suppose I have to check if an array is Empty ? I Tried to change the object type expected but it doesn’t work.

  3. Problem with data using built-in Shopify Action connector
    Also I got some data error when fetching data from Shopify.
    For example for an specific order already closed, I cannot get the Customer information using the Shopify Node.
    However If I check the endpoint related to get orders from Shopify API by using Postman I got the correct data. So n8n don’t get get me the right data in the first node.

  4. Summarize Node, wrong calculation
    The calculation value after I split out a field (transactions) and summarize (SUM function applied to field amount) it’s wrong, returns zero.

It is very frustrating, I spent several hours trying to accomplish this task, so I hope you can share some samples or guides to solve this issues.

What is the error message (if any)?

ERROR: ‘refunds_list’ expects a object but we got ‘[object Object],[object Object]’ [item 0]
To fix the error try to change the type for the field “refunds_list” or activate the option “Ignore Type Conversion Errors” to apply a less strict type validation

Please share your workflow

I can’t share it, too much characters for the topic ???

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version: 1.31.1
  • Database (default: SQLite):
  • **n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
  • **Operating system: Windows 11 Pro


I cannot paste the workflow, so I shared the file.

results from last node:

    "order_id": 5630919639260,
    "order_number": 5473,
    "created_date": "2024-02-27T15:15:20-06:00",
    "update_date": "2024-03-04T14:39:07-06:00",
    "Month": "X Febrero",
    "Items_qty": "0 3",
    "financial_status": "",
    "sub_total": "0",
    "Shpping": "0",
    "Tax": "0",
    "Returns": "0",
    "Disccounts": "0",
    "Discount_Code": "NA",
    "Comissions": "0",
    "Payment_Method": "NA",
    "Customer_ID": "NA",
    "Customer_FirstName": "NA",
    "Customer_LastName": "NA",
    "Customer_FullName": "NA",
    "Customer_Email": "NA",
    "Custome_PhoneNumber": "NA",
    "Marketing_Email": "NA",
    "Marketing_SMS": "NA",
    "Costumer_Ammount_Orders": "0",
    "Order_URL": "NA",
    "Source_Name": "NA",
    "Source_URL": "NA",
    "UTM_Tracking": "NA",
    "Shipping_Method": "na",
    "Shipping_Company": "NA",
    "Order_TAGS": "NA",
    "Shipping_AddressName": "NA",
    "Shipping_Phone": "NA",
    "Shipping_Address 1": "NA",
    "Shipping_Address 2": "NA",
    "Shipping_Reference": "NA",
    "Shipping_City": "NA",
    "Shipping_State": "NA",
    "Shipping_ZipCode": "NA",
    "Shipping_Country": "NA",
    "Billing_Name": "NA",
    "Billing_Phone": "NA",
    "Billing_Address 1": "NA",
    "Billing_Address 2": "NA",
    "Billing_City": "NA",
    "Billing_State": "NA",
    "Billing_ZipCode": "NA",
    "Billing_Country": "NA",
    "Shipping_Neighbor": "NA",
    "Billing_Neighbor": "NA",
    "Shipment_status": "NA",
    "Shipping_Tracking_Number": "NA",
    "Shipping_URL_Tracking": "NA",
    "UTM": "NA",
    "Costumer_TAGS": "NA"

Another issue.
I added an IF node to check if array is Empty.
If True I want to continue processing the fields in google sheets.
When False, I will summarize some fields and then processing in google sheets.

But when is True I cannot get any data???
I added another google sheet node to try get information from Loop over item node (from several back nodes) when is True but it doesn’t work.

hello @ingeniux

Can you provide some samples of the Shopify output?

At first glance, you have a lot of strange things there…
Like the Split Node after the Loop node (so you can’t access the linked item of the Loop node anymore), the Loop node without the loop, two Split Nodes one after another…

Without the sample of the Shopify node, it will be difficult to suggest anything

hello barn4k!
About the first split out node after the loop over item node, I didn’t find other way to to grab the information from the array and summarize the field quantity(line_items.quantity field).
Anyway I share the Json returned by the first node (at this time only 1 order is returned).

    "id": 5633165394140,
    "closed_at": "2024-02-29T12:57:58-06:00",
    "confirmed": true,
    "contact_email": "[email protected]",
    "created_at": "2024-02-29T12:57:56-06:00",
    "currency": "MXN",
    "financial_status": "paid",
    "fulfillment_status": "fulfilled",
    "name": "#5478",
    "number": 4478,
    "order_number": 5478,
    "total_price": "424.15",
    "total_tax": "58.50",
    "total_tip_received": "0.00",
    "total_weight": 100,
    "updated_at": "2024-03-04T11:58:20-06:00",
    "user_id": 62281318561,
    "customer": {
      "id": 7145717498076,
      "created_at": "2024-02-29T12:55:20-06:00",
      "updated_at": "2024-02-29T12:57:56-06:00"
    "fulfillments": [
        "id": 5055918506204,
        "created_at": "2024-02-29T12:57:57-06:00",
        "name": "#5478.1",
        "order_id": 5633165394140,
        "status": "success",
        "updated_at": "2024-02-29T12:57:57-06:00",
        "line_items": [
            "id": 13972399390940,
            "fulfillable_quantity": 0,
            "fulfillment_service": "manual",
            "fulfillment_status": "fulfilled",
            "grams": 100,
            "name": "Bodysuit - Chalk - G / Blanco",
            "price": "424.15",
            "product_exists": true,
            "product_id": 8085853995228,
            "properties": [],
            "quantity": 1,
            "requires_shipping": true,
            "sku": "BPALSY002C",
            "taxable": true,
            "title": "Bodysuit - Chalk",
            "total_discount": "0.00",
            "variant_id": 44040670806236,
            "variant_inventory_management": "shopify",
            "variant_title": "G / Blanco",
            "vendor": "Babylon"
    "line_items": [
        "id": 13972399390940,
        "fulfillable_quantity": 0,
        "fulfillment_service": "manual",
        "fulfillment_status": "fulfilled",
        "gift_card": false,
        "grams": 100,
        "name": "Bodysuit - Chalk - G / Blanco",
        "price": "424.15",
        "product_exists": true,
        "product_id": 8085853995228,
        "quantity": 1,
        "requires_shipping": true,
        "sku": "BPALSY002C",
        "taxable": true,
        "title": "Bodysuit - Chalk",
        "total_discount": "0.00",
        "variant_id": 44040670806236,
        "variant_inventory_management": "shopify",
        "variant_title": "G / Blanco",
        "vendor": "Babylon"

Thanks for your help

I’ve optimized the workflow based on your input. As you have quite a big workflow, there is some JS magic

And how things work:

  • Year - I just converted the date string from the input into the Luxon date object.
  • Month - almost the same, but I’ve used the Spain locale to get month names from the date string.
  • Items qty - that one is a little tricky. I’ve reformated the array to receive only the amount for each array item. Then I used the reduce function to summarize the numbers inside the array.

Hi barn4K,
Perfect, I will give it a try and I let you know how it it works.
Thank you very much for your help and time.

1 Like

I tried out your solution and it does work, thanks!
The problem now is related to the values computed.
Since we are talking about Orders, sometimes the refunds quantities doesn’t exist.
I use the IF node to check and make the calculations however when I tried to access in the last node to update my google sheets, returns an error.
I tried to figuring out how to access these computed values but with not success.
I think the problem it is IF node.
I don’t find how you can access a variable that sometimes exists and sometimes doesn’t exist, n8n seem you cannot modified any variables previously computed.

In my case the error the google node returns and error:
ERROR: no data, execute “computeReturns” node first

I did it, it doesnt work.

Any help?

I can’t paste the code for the flow, again,
I share the json file

It’s because you trying to access the node, that hasn’t been executed. You need to point to the next Code node instead. But you have forgotten to enable the “Include other input fields” switch in the computeReturn node to do so.

And why are you using so many code nodes? You can join them together. Actually, you need only one Code node, where you can prepare everything you need for gSheet. I’ve prepared an example, but I didn’t fill every field as it is time-consuming. I suppose you’ve got the idea

1 Like

Hi barn4k!
Thanks for the tips related to Code node. I didn’t know how to make the calculations in just one node, now is easier to maintain the changes.
I tested with my Google Sheets and works perfect!

Thank you very much for your help! :ok_hand: :+1:

1 Like

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