Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Ability to get Return Information via the API

Ability to get Return Information via the API

rodschuler
Shopify Partner
4 0 1

Hi,

 

I know this question has been asked in various forms but was wondering if there is any update on being able to retrieve the return information from Shopify via the API.  We seem to have full access to the refund data set but not the return one.

 

e.g.

 

If I initiate a return using the return items in the admin I'm able to select the items to return, select a return reason and start the return process.

 

A webhook is generated saying that the order has been changed but there is no way to actually query that return information through the API.  I can see that the Shopify application is querying new data sets that are not available in the API (returns).  The only way I can know that a return has been initiated is by looking at the events for the order

 

e.g.

 

You created a return #1223-R1 for this order.

 

or something similar will appear when you query the events for the order.

 

Until a refund is done for the return there is no way to know what items are being returned.  Additionally, there is no way to get the actual return reason that was set when the return was initiated.

 

Are there plans to add this to the API?

Building the next generation of startups.
Replies 6 (6)

wzyandi
Shopify Partner
9 0 1

what you describe is very clear🤣,I also found that what about return order information can get is only event msg,detail about item or return reason is no way,I lost day and day to find a solution but has no result

1、Order API:get nothing about return

2、Refund API:when order status is return in process,has no refund

3、Event API:only get a less information tell that order has a return,but has no return detail

4、GraphQL API:just a different way get same thing as Rest API

wzyandi_0-1653282844255.png

 

tushargtti
Visitor
3 0 0

Did you or your team were able to achieve Return retrieval ? If so, please share the solution.

ShopifyDevSup
Shopify Staff
1453 238 522

Hi @tushargtti, @rodschuler, @wzyandi, and @wereacommunity,

I'm happy to let you know that we have since added a bunch of new endpoints and functionality relating to Returns with our Admin API. You can now retrieve returns via the api, as well as subscribe to webhooks to be notified when returns are created.

Specifically you can subscribe to the returns/approve webhook to be notified when returns are created, along with receiving information on the line items returned and the reason for the return. Here's an example payload that this webhook will send:
 

{
 "id": 8244166818,
 "admin_graphql_api_id": "gid://shopify/Return/8244166818",
 "status": "open",
 "order": {
   "id": 6421645394082,
   "admin_graphql_api_id": "gid://shopify/Order/6421645394082"
 },
 "total_return_line_items": 1,
 "name": "#1023-R1",
 "return_line_items": [
   {
     "id": 11041046690,
     "admin_graphql_api_id": "gid://shopify/ReturnLineItem/11041046690",
     "fulfillment_line_item": {
       "id": 12278438789282,
       "admin_graphql_api_id": "gid://shopify/FulfillmentLineItem/12278438789282",
       "line_item": {
         "id": 14301075964066,
         "admin_graphql_api_id": "gid://shopify/LineItem/14301075964066"
       }
     },
     "quantity": 1,
     "return_reason": "unknown",
     "return_reason_note": "",
     "customer_note": null
   }
 ]
}

Additionally you can retrieve information on returns from the Order object in the Admin API, or by making a query for the return directly

 

Here's also a guide that we have posted on our Shopify.dev documentation that provides further advice and guidance on how to manage returns with the API.

 

I hope this helps, and I hope you have a great day 🙂

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

zee-liwa
Shopify Partner
3 0 0

what is the full URL for returns/approve api end point. 

ShopifyDevSup
Shopify Staff
1453 238 522

Hey @zee-liwa - the returns approval mutation is only available in our GraphQL Admin API at the moment and would just use the following endpoint/request method:

POST https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json

There's a bit more info in our developer documentation here on the returnApproveRequest mutation itself. Hope this helps! 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

wereacommunity
Visitor
2 0 2

Bumping this post because we are looking for this data to be available. Thank you!