I just did an indepth AUDIT for a merchant new to Shopify, whereby she needed to accurately assess her cost of good sold during the half year of 2020. Shopify cannot do this. So I did it, and along the way, I had to deal with orders and refunds. And stock. So I used this query, which was fine for these purposes.
NOTE: I AGREE 100%. The GraphQL and refunds is currently not consistent, and somewhat opaque, and only by lots of trial and error did I figure it out. I exposed my questions, and of course, NO ONE on these forums contributed one iota of help. Crickets do chirp.
mutation{
bulkOperationRunQuery(
query:"""
{
orders(query:"created_at>'2020-06-01,created_at<'2020-07-01") {
edges {
node {
id
refunds {
id
restocked
refundLineItems {
edges {
node {
restocked
lineItem {
quantity
sku
}
}
}
}
}
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}