Development discussions around Shopify APIs
Hi, I want to get data of customers with ID. I see an example like below code but its same code repeting multiple time, is there any way to call like `Customers(ids: [graphqlid, graphqqlid]){ ...}`
customer1: customer(id:"gid://shopify/Customer/1310260264982") {
displayName
}
customer2: customer(id:"gid://shopify/Customer/1310260789270") {
displayName
}
customer3: customer(id: "gid://shopify/Customer/1310260854806") {
displayName
}
}
Hi,
In case you still have this issue or anybody else is looking for the proper answer, here it goes.
You can query multiple id's like this:
```
{
nodes( ids: [ "gid://shopify/Customer/3781894373511", "gid://shopify/Customer/3903388090503", "gid://shopify/Customer/3903390777479" ] ) {
...on Customer {
displayName
}
}
}
```
Hi,
In case you still have this issue or anybody else is looking for the proper answer, here it goes.
You can query multiple id's like this:
{
nodes( ids: [ "gid://shopify/Customer/3781894373511", "gid://shopify/Customer/3903388090503", "gid://shopify/Customer/3903390777479" ] ) {
...on Customer {
displayName
}
}
}
Hope this helps.
Paul
Hi @Paul_vd_Dool !
Thank you for the example you had provided - are you able to provide a second example that passes the array of IDs as variables?
We are trying to switch from your REST API GET /customers call, which we filter by IDs -
https://shopify.dev/api/admin-rest/2021-10/resources/customer#[get]/admin/api/2021-10/customers.json
To your graphQL customers query, and are facing some difficulties in incorporating variables with nodes.
Any idea how we can achieve this?
Thanks!
Hi @Thalia-Yotpo ,
I've grabbed an example from my app.
query getSubCustomers($ids: [ID!]!) {
nodes(ids: $ids) {
... on Customer {
id
displayName
email
}
}
}
// variables
{
"ids": [
"gid://shopify/Customer/987654321",
"gid://shopify/Customer/123456789"
]
}
I hope this helps.
User | RANK |
---|---|
8 | |
7 | |
3 | |
3 | |
3 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By