Questions and discussions about using the Shopify CLI and Shopify-built libraries.
I'm trying to generate a picking list from an external inventory system by syncing orders placed with the external system. The admin or staff then will open up picking lists from my app using appbridge and print them.
The graphql restrictions seem pretty high so I store as many identifiers as I can when I bulk import the orders into my external system but I didn't want to copy a bunch of customer information so I only store the IDS. For the picking list I need to show the customer name and the customer shipping city, state and zip. I have stored the order GQL id, customer GQL id, shipping GQL id. I can fetch the customers by putting together a long list of single customer requests into one big request but how can I query the shipping address? I see a MailingAddress object but is there an easier way to do all this?
My current psuedo code looks like this:
I forgot the name of it but I'm using Aliases to fetch the customers. I have only tested up to 3 at a time but eventually it will be around 30 or 40 at a time. I'm not sure graphql will support that but that was my plan. Will that work in parallel to some sort of MailingAddress query ?
My customer query looks like this:
{ customer0: customer(id: "gid://shopify/Customer/REDACTEDID0") { id, displayName }
customer1: customer(id: "gid://shopify/Customer/REDACTEDID1") { id, displayName }
customer2: customer(id: "gid://shopify/Customer/REDACTEDID2") { id, displayName } }
Then I unpack it based on the suffix index after "customer".
Would I try to use an order query but then just fetch the address nested inside the order?
This is working but I was hoping there was a better way:
{ order0: order(id: "gid://shopify/Order/REDACTEDID0") { id, shippingAddress { id, city, zip } }
order1: order(id: "gid://shopify/Order/REDACTEDID1") { id, shippingAddress { id, city, zip } }
order2: order(id: "gid://shopify/Order/REDACTEDID2") { id, shippingAddress { id, city, zip } } }