I’m quite new to GraphQL syntax so would love to see why I am getting null back as my result.
What I am trying to is query orders in a store and retrieve back the UTM Params associated with that order.
This is the query:
query {
orders(first:10) {
edges {
node {
customerJourney {
moments {
... on CustomerVisit {
utmParameters {
source
campaign
content
medium
term
}
}
}
}
}
}
}
}
This is the results:
{
"data": {
"orders": {
"edges": [
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
},
{
"node": {
"customerJourney": null
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 42,
"actualQueryCost": 22,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 978,
"restoreRate": 50
}
}
}
}
It seems all the customerJourney’s are returning null. Is there something wrong with the query?
2 Answers
Shopify will only show data on orders that are less than 60 days old. As you have stated "first: 10" you’re asking for the first 10 orders on that store which are likely over 60 days old. Try getting the last 10 orders using the reverse boolean.
query {
orders(first: 10, reverse:true) {
edges {
node {
customerJourney {
moments {
... on CustomerVisit {
utmParameters {
source
campaign
content
medium
term
}
}
}
}
}
}
}
}