Hey,
Wondering what would be the best query to get information on an orders return/exchange for graphQL…
Namely:
- Whats been Returned
- Whats been Sent Out
- Any transactions associated with the exchange/refund.
- Any Additional Fee’s
Hey,
Wondering what would be the best query to get information on an orders return/exchange for graphQL…
Namely:
Hey Chris,
I can share some queries on how I would approach these topics. If these are fitting for your use case is for you to decide. I’m assuming API Version 2025-01
.
query GetOrderReturns($orderId: ID!) {
order(id: $orderId) {
returns(first: 10) {
edges {
node {
id
status
returnLineItems(first: 10) {
nodes {
...on ReturnLineItem {
fulfillmentLineItem {
lineItem {
id
variant {
id
}
title
quantity
}
}
}
}
}
}
}
}
}
}
query GetFulfilledLineItems($orderId: ID!) {
order(id: $orderId) {
fulfillments(first: 10) {
status # use this status to see if line items have been sent
fulfillmentLineItems(first: 10) {
nodes {
lineItem {
id
title
quantity
}
}
}
}
}
}
query GetOrderRefundTransactions($orderId: ID!) {
order(id: $orderId) {
refunds(first: 10) {
id
transactions(first: 5) {
nodes {
kind
fees {
amount {
amount
currencyCode
}
}
amountSet {
presentmentMoney {
amount
currencyCode
}
}
status
}
}
}
}
}
I hope I could provide you with a starting point.
Kevin