I am using Grapqhl Query to fetch the order/refund/return data.
Now
There is an order with one line item (Quantity = 5) that has been fully fulfilled, and a return is created for 3 items without restocking. After that, 2 out of the 3 returned items are restocked.
Now I am looking for a way to find out how many items were restocked ?
From where Can I get this partial restocked Item Quantity ?
I have searched through order query , return query and refund query and also reached out to customer support via email and they are also unable to help me and suggested me to post my Issue on this community so that any shopify developer can look into it.
Customer support also suggested to use mutation of ‘reverseFulfillmentOrderDispose’ but this is not able to solve my issue since I am only fetching data of the actions performed by the user.
1 Like
Hey @Webgility_Inc,
Happy to dig in to this with you. Can you confirm how the return was created? If you’re using POS, there may not be a record of the disposition for the non-restocked items. (context on that in this thread here: Return location for items not returned to stock using GraphQL API - #9 by KyleG-Shopify
If it was created through other methods, reverse fulfillment orders should have the information you need:
REturn was created by user on SHopify dierctly.. it wasn’t created by any API or Graphql
Thanks! Since your return was created directly in Shopify admin, the dispositions field will show you exactly which items were restocked.
Here’s the best approach using the dispositions
field in reverse fulfillment orders, which tracks the physical handling of all returned items:
query GetOrderDispositions($id: ID!) {
order(id: $id) {
id
name
returns(first: 10) {
edges {
node {
id
name
reverseFulfillmentOrders(first: 10) {
edges {
node {
id
lineItems(first: 20) {
edges {
node {
id
totalQuantity
fulfillmentLineItem {
lineItem {
id
name
}
}
dispositions {
id
quantity
type
location {
id
name
}
}
}
}
}
}
}
}
}
}
}
}
}
For your scenario (5 items → 3 returned without restocking → 2 later restocked), here’s what the response looks like:
"returns": {
"edges": [
{
"node": {
"id": "gid://shopify/Return/15574990870",
"name": "#1425-R1",
"reverseFulfillmentOrders": {
"edges": [
{
"node": {
"lineItems": {
"edges": [
{
"node": {
"totalQuantity": 3,
"dispositions": []
}
}
]
}
}
}
]
}
}
},
{
"node": {
"id": "gid://shopify/Return/15575023638",
"name": "#1425-R2",
"reverseFulfillmentOrders": {
"edges": [
{
"node": {
"lineItems": {
"edges": [
{
"node": {
"totalQuantity": 2,
"dispositions": [
{
"quantity": 2,
"type": "RESTOCKED",
"location": {
"name": "1 Sir Winston Churchill Square"
}
}
]
}
}
]
}
}
}
]
}
}
}
]
}
To get your partial restocked quantity, look for dispositions with type: "RESTOCKED"
and sum their quantities. In this case, you’ll find exactly 2 restocked items from the second return, while the first return shows empty dispositions.
Hey @Webgility_Inc , did the above help?