Forum Academy Marketplace Showcase Pricing Features

Saving Data from Shopify API - Nested Data

Hoping someone might have an answer for this. I’ve searched the forum and can’t quite find an answer that seems to fit. I’m creating a custom application integrating with my Shopify store. I connected to the API fine. However, I’m pulling a list of “orders” which has a list of “line items” and each line item has a list of “properties”. If I pull data into nested repeating groups, I can get the data to show exactly the way I want to. The issue comes in when I try to set up a backend workflow to save all that data into my database. I can’t find a way to save the list of “line items” to save to the “orders” that I’ve created. It only seems to save one “line item”. Any help is appreciated. Thanks!

Hello @xan.hong

  • Create a backend workflow that creates a thing with all the necessary parameters so that the subsequent things can be created and related
  • Schedule the RG’s list to be sent to that backend workflow so that it runs through all of its entries (using schedule api workflow on a list)
  • Alternatively you can set up the backend workflow to work recursively with an extinguishable condition so that it stops instead of looping perpetually (e.g. search for entries count < than the rg’s entries count) … or build temporary calcs in the flow to avoid the search if the lists are too long)

Thanks cmarchan. So it sounds like the only way to save the information I want is from the repeating groups. I’m still unclear of how to add the list of “line items” to the order that I create from the original repeating group. See screenshot for order 4747 below - 2 line items for the one order. Thanks again.

You indicate that you are pulling orders and each of them have a list of line items. There they are. Just make sure that you create them one by one as well. Perhaps a nested line item recursive inside the order recursive.

As i said, I can get them to show in the repeating group, but I’m struggling with then how to save the data to the database. More specially, I can save the list of orders, but I’m struggling to add the list of line items to their respective orders. Thanks.

Didn’t work with the Shopify API myself, so I am not sure. But how about saving the line items as a separate data type / table with a reference to the originating order…

Perhaps you could work with your data more flexibly in this way.

EDIT: I notice that my reply comes 11 months after original post. However I will leave it here in case anyone finds it useful.