Shopify - order fulfillment - issue with split by line_items

I have a simple workflow where I want to get fulfillment information by line item from Shopify

When I try to split the output of the Shopify node by “line_items” I get the message: “The provided field ‘line_items’ is not an array”

This is true, “line_items” is not an array here.
But if I check the json directly from Shopify actually “line_items” is an array.

image

How do I get the fulfillment data by item in this situation?

Thanks

Hi @AdriKant - sorry to hear you’re running into trouble with this!

I don’t quite know what your workflow setup is, but you should be able to access this through $json.line_items. Can you give that a try? :+1:

Hi @EmeraldHerald I have tried and has the same problem.
I am also trying with a node called “Order Partial Fulfillment”, maybe this one allows to split by line items

Hey @AdriKant,

Where are you using $json.line_items if you could show where you have it set and the message you are using we can take another look.

See here

This is the flow

First node detail

Hey @AdriKant,

That will be it, Because it isn’t an array you can just use $json.line_items as it is. One thing you could do is use a set node to set the options you want using $json.line_items.x for each field.

1 Like

Thanks
could you explain me more in detail what you intend? I am not a developer…

Hey @AdriKant,

If you can provide the json data and what fields are in the sheet we can put an example together for you, The quick version would be to add a Set node instead of Item Lists then create a variable for each column you want in the sheet and for the value use $json.line_items.x where x is the name of the item.

1 Like

The sheet is still to be built.
But let’s assume we have these columns:

  • order id
  • SKU → consider there can be more than 1 and we need to have separate lines in the GSheet
  • date/time (this is not in the json)

Here the json:
[

{

“id”:3922114773201,

“line_items”:{

“id”:11038389108945,

“admin_graphql_api_id”:“gid://shopify/LineItem/11038389108945”,

“fulfillable_quantity”:0,

“fulfillment_service”:“manual”,

“fulfillment_status”:“fulfilled”,

“gift_card”:false,

“grams”:0,

“name”:“Black Eco-leather Shopping Bag”,

“price”:“140.00”,

“price_set”:{

“shop_money”:{

“amount”:“140.00”,

“currency_code”:“CHF”

},

“presentment_money”:{

“amount”:“140.00”,

“currency_code”:“CHF”

}

},

“product_exists”:true,

“product_id”:7229517267153,

“properties”:[

],

“quantity”:1,

“requires_shipping”:true,

“sku”:“202305015”,

“taxable”:true,

“title”:“Black Eco-leather Shopping Bag”,

“total_discount”:“0.00”,

“total_discount_set”:{

“shop_money”:{

“amount”:“0.00”,

“currency_code”:“CHF”

},

“presentment_money”:{

“amount”:“0.00”,

“currency_code”:“CHF”

}

},

“variant_id”:41513665003729,

“variant_inventory_management”:“shopify”,

“variant_title”:null,

“vendor”:“Versace Jeans Couture”,

“tax_lines”:[

{

“channel_liable”:false,

“price”:“6.43”,

“price_set”:{

“shop_money”:{

“amount”:“6.43”,

“currency_code”:“CHF”

},

“presentment_money”:{

“amount”:“6.43”,

“currency_code”:“CHF”

}

},

“rate”:0.077,

“title”:“MwSt”

}

],

“duties”:[

],

“discount_allocations”:[

{

“amount”:“50.00”,

“amount_set”:{

“shop_money”:{

“amount”:“50.00”,

“currency_code”:“CHF”

},

“presentment_money”:{

“amount”:“50.00”,

“currency_code”:“CHF”

}

},

“discount_application_index”:0

}

]

}

}

]

I have made a test with the “Shopify - Order Updated” node and I think it is a better data source compared to the “Order Fulfilled” one.
I just need to implement the right logic to extract the fulfillment information.