Greetings,
we are import orders from Shopify to our system, for that we need information were the order was created/sold or from where the order was send from. To accomplish that execute following GraphQl-Query (truncated for brevities sake):
query getOrder($id: ID!, $itemLimit: Int = 3) {
order(id: $id) {
id
name
createdAt
displayFinancialStatus
displayFulfillmentStatus
transactions {
createdAt
status
test
gateway
receipt
}
location
physicalLocation {
name
id
}
fulfillable
fulfillments {
createdAt
status
location {
address {
address1
address2
zip
city
countryCode
}
}
}
publication {
id
name
}
tags
}
}
To retrieve the location we look at fulfillments. However we are seeing some orders which have displayFinancialStatus=PAID and **displayFulfillmentStatus=**UNFILFILLED where that field is null. To work around that, we wanted to create a fallback and use the field physicalLocation. According to this documentation: Order#field-order-physicallocation I assume that the this field will have the location information. But in our case it is null as well, the same goes for the deprecated field location.
Our customers mentioned that they are able to see the location in for the orders
How can we retrieve the location of an order? I did not see any field in the GraphQL docs to retrieve it.
Is maybe the GraphQL query wrong? (seams to be correct at least from my eyes)
Thank you for your help already.
Best regards
Daniel
Hey Daniel - thanks for getting in touch, this does definitely seem like an odd issue. I tried to replicate the issue on my end here using the following query:
{
orders (first:40) {
edges {
node {
id
physicalLocation {
id
name
}
}
}
}
}
In my test environment, the query pulled up the names of the locations when they contained items that were stocked at physical fulfillment locations as expected - can you try changing the below:
}
location
physicalLocation {
name
id
}
to this:
}
physicalLocation {
name
id
}
My thinking is that when querying an order’s original fulfillment location it should be referenced as “PhysicalLocation”. There’s a bit more info in our dev docs that goes over this in some more detail.
Hope this provided some next steps to look into - happy to dig into this more with you if need be as well, just hit me up with a reply here!
Cheers,
Hi Alan,
thank you for your response.
I changed the query to the following:
query getOrder($id: ID!) {
order(id: $id) {
id
physicalLocation {
name
id
}
}
}
However the response is the same as before. physicalLocation is null:
{
"data": {
"order": {
"id": "gid://shopify/Order/
Is it possible to validate that the order has a location assigned to it?
What I can see however is that the order got created by an online store. Do such orders even have a **physicalLocation** associated to them?
Regards Daniel
Hey Daniel,
Thanks for your patience here - I was able to confirm on our end that it’s expected that orders purchased through the Online Store aren’t going to show a Physical Location through that query. The “physical location” field would appear as “null”.
Basically, this is just because the Online Store isn’t considered as a “physical location” whereas orders purchased through the Shopify Point of Sale app are effectively connected to the Physical Location where the POS app is being used through the app’s settings. The “PhysicalLocation” object is connected to where the item was purchased and not where it will be fulfilled from if that makes sense.
That said, when it comes to fulfilment, I’d also recommend taking a look at the FulfillmentOrder Object and build a query around that object, as I believe you can use the “assignedlocation” field under the FulfillmentOrder object to pull a fulfillment location regardless of its status or where the order was purchased.
Hope this helps!