Bulk return order management

Hey,
I am building the bulk return order mutation and using this article:
https://shopify.dev/docs/api/usage/api-exploration/admin-graphiql-explorer
However, the first step uses the returnable fulfillment line items from a fulfilled order.
Order:
{
“order”: {
“id”: 6265162170669,
“admin_graphql_api_id”: “gid://shopify/Order/6265162170669”,
“app_id”: 1354745,
“browser_ip”: “43.240.10.154”,
“buyer_accepts_marketing”: true,
“cancel_reason”: null,
“cancelled_at”: null,
“cart_token”: null,
“checkout_id”: 38924435882285,
“checkout_token”: “70cd2b14bbc872da09a39f877f1ed549”,
“client_details”: {
“accept_language”: null,
“browser_height”: null,
“browser_ip”: “43.240.10.154”,
“browser_width”: null,
“session_hash”: null,
“user_agent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36”
},
“closed_at”: “2025-03-25T03:47:02-04:00”,
“company”: {
“id”: 2952102189,
“location_id”: 3205923117
},
“confirmation_number”: “1FP5M9Y5T”,
“confirmed”: true,
“contact_email”: “roshni@praella.com”,
“created_at”: “2025-03-25T03:33:45-04:00”,
“currency”: “USD”,
“current_subtotal_price”: “349.98”,
“current_subtotal_price_set”: {
“shop_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
}
},
“current_total_additional_fees_set”: null,
“current_total_discounts”: “0.00”,
“current_total_discounts_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“current_total_duties_set”: null,
“current_total_price”: “349.98”,
“current_total_price_set”: {
“shop_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
}
},
“current_total_tax”: “0.00”,
“current_total_tax_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“customer_locale”: “en”,
“device_id”: null,
“discount_codes”: ,
“email”: “roshni@praella.com”,
“estimated_taxes”: false,
“financial_status”: “paid”,
“fulfillment_status”: “fulfilled”,
“landing_site”: null,
“landing_site_ref”: null,
“location_id”: 102955942189,
“merchant_of_record_app_id”: null,
“name”: “#1009”,
“note”: null,
“note_attributes”: ,
“number”: 9,
“order_number”: 1009,
“order_status_url”: “https://demo-tejas.myshopify.com/90943389997/orders/6bc214b30337439afed2d3327b1608aa/authenticate?key=e5c9af2dd14c204934a23bf8254bbce1”,
“original_total_additional_fees_set”: null,
“original_total_duties_set”: null,
“payment_gateway_names”: [
“manual”
],
“phone”: null,
“po_number”: null,
“presentment_currency”: “USD”,
“processed_at”: “2025-03-25T03:33:45-04:00”,
“reference”: null,
“referring_site”: null,
“source_identifier”: null,
“source_name”: “shopify_draft_order”,
“source_url”: null,
“subtotal_price”: “349.98”,
“subtotal_price_set”: {
“shop_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
}
},
“tags”: “”,
“tax_exempt”: false,
“tax_lines”: ,
“taxes_included”: false,
“test”: false,
“token”: “6bc214b30337439afed2d3327b1608aa”,
“total_discounts”: “0.00”,
“total_discounts_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“total_line_items_price”: “349.98”,
“total_line_items_price_set”: {
“shop_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
}
},
“total_outstanding”: “0.00”,
“total_price”: “349.98”,
“total_price_set”: {
“shop_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “349.98”,
“currency_code”: “USD”
}
},
“total_shipping_price_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“total_tax”: “0.00”,
“total_tax_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“total_tip_received”: “0.00”,
“total_weight”: 0,
“updated_at”: “2025-03-25T03:47:02-04:00”,
“user_id”: null,
“billing_address”: null,
“customer”: {
“id”: 8610840805677,
“email”: “roshni@praella.com”,
“created_at”: “2025-02-21T00:37:21-05:00”,
“updated_at”: “2025-03-25T03:33:45-04:00”,
“first_name”: “test”,
“last_name”: “praella”,
“state”: “disabled”,
“note”: null,
“verified_email”: true,
“multipass_identifier”: null,
“tax_exempt”: false,
“phone”: null,
“email_marketing_consent”: {
“state”: “subscribed”,
“opt_in_level”: “single_opt_in”,
“consent_updated_at”: “2025-02-21T00:37:22-05:00”
},
“sms_marketing_consent”: null,
“tags”: “shopify-forms-332807”,
“currency”: “USD”,
“tax_exemptions”: ,
“admin_graphql_api_id”: “gid://shopify/Customer/8610840805677”
},
“discount_applications”: ,
“fulfillments”: [
{
“id”: 5510278840621,
“admin_graphql_api_id”: “gid://shopify/Fulfillment/5510278840621”,
“created_at”: “2025-03-25T03:47:01-04:00”,
“location_id”: 102955942189,
“name”: “#1009.1”,
“order_id”: 6265162170669,
“origin_address”: {},
“receipt”: {},
“service”: “manual”,
“shipment_status”: null,
“status”: “success”,
“tracking_company”: null,
“tracking_number”: null,
“tracking_numbers”: ,
“tracking_url”: null,
“tracking_urls”: ,
“updated_at”: “2025-03-25T03:47:01-04:00”,
“line_items”: [
{
“id”: 15526023659821,
“admin_graphql_api_id”: “gid://shopify/LineItem/15526023659821”,
“attributed_staffs”: ,
“current_quantity”: 2,
“fulfillable_quantity”: 0,
“fulfillment_service”: “manual”,
“fulfillment_status”: “fulfilled”,
“gift_card”: false,
“grams”: 0,
“name”: “Farmhouse Play Kitchen with EZ Kraft Assembly™ (Copy)”,
“price”: “174.99”,
“price_set”: {
“shop_money”: {
“amount”: “174.99”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “174.99”,
“currency_code”: “USD”
}
},
“product_exists”: true,
“product_id”: 9929141682477,
“properties”: ,
“quantity”: 2,
“requires_shipping”: true,
“sku”: null,
“taxable”: true,
“title”: “Farmhouse Play Kitchen with EZ Kraft Assembly™ (Copy)”,
“total_discount”: “0.00”,
“total_discount_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“variant_id”: 50396015362349,
“variant_inventory_management”: “shopify”,
“variant_title”: null,
“vendor”: “Demo-Chirag-khunt”,
“tax_lines”: ,
“duties”: ,
“discount_allocations”:
}
]
}
],
“line_items”: [
{
“id”: 15526023659821,
“admin_graphql_api_id”: “gid://shopify/LineItem/15526023659821”,
“attributed_staffs”: ,
“current_quantity”: 2,
“fulfillable_quantity”: 0,
“fulfillment_service”: “manual”,
“fulfillment_status”: “fulfilled”,
“gift_card”: false,
“grams”: 0,
“name”: “Farmhouse Play Kitchen with EZ Kraft Assembly™ (Copy)”,
“price”: “174.99”,
“price_set”: {
“shop_money”: {
“amount”: “174.99”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “174.99”,
“currency_code”: “USD”
}
},
“product_exists”: true,
“product_id”: 9929141682477,
“properties”: ,
“quantity”: 2,
“requires_shipping”: true,
“sku”: null,
“taxable”: true,
“title”: “Farmhouse Play Kitchen with EZ Kraft Assembly™ (Copy)”,
“total_discount”: “0.00”,
“total_discount_set”: {
“shop_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
},
“presentment_money”: {
“amount”: “0.00”,
“currency_code”: “USD”
}
},
“variant_id”: 50396015362349,
“variant_inventory_management”: “shopify”,
“variant_title”: null,
“vendor”: “Demo-Chirag-khunt”,
“tax_lines”: ,
“duties”: ,
“discount_allocations”:
}
],
“payment_terms”: null,
“refunds”: ,
“shipping_address”: null,
“shipping_lines”:
}
}

Graphql query for return the returnable fulmilments:
query returnableFulfillmentsQuery {
returnableFulfillments(orderId: “gid://shopify/Order/6265162170669”, first: 10) {
edges {
node {
id
fulfillment {
id
}
# Return the first ten returnable fulfillment line items that belong to the order.
returnableFulfillmentLineItems(first: 10) {
edges {
node {
fulfillmentLineItem {
id
}
quantity
}
}
}
}
}
}
}
response:
{
“data”: {
“returnableFulfillments”: {
“edges”:
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 50,
“actualQueryCost”: 2,
“throttleStatus”: {
“maximumAvailable”: 2000,
“currentlyAvailable”: 1998,
“restoreRate”: 100
}
}
}
}

The issue is that I am getting the empty array of returnable fulfillment items.

1 Like

Hey @Roshni_Sansare :waving_hand: .

I did a little bit of digging to this on our backend here and it does look like Order ID 6265162170669 should have returnable fulfillments associated with it.

I do know that with our GraphiQL Explorer app, we do sometimes limit the data that can be seen/manipulated with it, though, I’m not exactly sure if that’s what is happening in this case.

I’m going to get in touch with our developers to confirm expected behaviour on this for you and I’ll loop back when I have some more info to share!

  • Alan G | Shopify Developer Support

Hi again @Roshni_Sansare - I was able to speak with our developers on this just now and they mentioned that this is currently a known issue which they are triaging. I don’t have a specific turnaround time at the moment, but the workaround that we would suggest would be setting up a custom app if possible.

Here’s a link for setting this up through a partner account: Custom apps
And then through the admin: https://help.shopify.com/en/manual/apps/app-types/custom-apps

The easiest way to set this up would likely be through a custom app in the admin since you can set the access scopes through the UI, then you can grab your auth token from the admin directly and use it within a third party API client like Postman

Definitely understand that this isn’t ideal, so I’ve passed your report on to our developers directly as well and if I can help with anything on my end, just ping me in the thread here and I’ll take a look.

Thank you so much, @Alan_G. I appreciate your solution. I will be trying this through a custom app.

Hey @Alan_G ,
Can you please move my request forward as I want the exact output what the API is giving and Wanted to use only Graphql API as I can not find any admin API: REST Admin API reference

Hey @Roshni_Sansare :waving_hand:

You should be able to use the same GraphQL Admin API that is available in the GraphiQL app in the Admin UI with a custom app: GraphQL Admin API reference

You’d just need to use this endpoint in your API client if you’re not building the integration directly in code:

https://{shop}.myshopify.com/admin/api/2025-01/graphql.json \

I believe the query you were using to grab the returnable fulfillment line items in your first post should work that way.

Hope I’m understanding things correctly - let me know if I can clarify anything!

Hey @Alan_G ,
Thank you! It works for me with using the Postman.
It would be great if you could tell me the reason why I am not able to get the result from the GreaphiQL app.

Hi @Roshni_Sansare - there is a known issue with this specific operation in the GraphiQL app, which our devs are triaging. Until it’s resolved, the best workaround is what @Alan_G recommended - to run this via a custom app in Postman.