Liquid, JavaScript, themes, sales channels
GET /admin/api/2021-01/orders/{order_id}/refunds.json
Only one order can be accessed. How can I access the used refund order。
Are you locked to REST Admin API calls? GraphQL Bulk Operations would do the trick
https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api
Just a quick query draft:
{
orders {
edges {
node {
name
id
createdAt
updatedAt
processedAt
cancelledAt
refunds {
id
createdAt
note
refundLineItems {
...
}
transactions {
...
}
}
}
}
}
}
You need to introduce required fields for refundLineItems and transactions. Bulk Operations returns a jsonl file, so you need to store it (disk or memory, better on disk for lower memory consumption) and treat the returned data line by line. The best part is that Bulk Operations defers all the processing stuff to Shopify, so you only need to do one API call and then do some short polling until the processing is completed.
Cheers!
Is there any other API that can access all refund orders?
You have all the GraphQL documentation here https://shopify.dev/docs/admin-api/graphql/reference
but if you really need to use the REST Admin API, you can make a call to GET /admin/api/2021-01/orders.json and then add a search syntax parameter for retrieving only refunded o partially refunded orders like financial_status=refunded or financial_status=partially_refunded.
This will return you all the refunded or partially_refunded orders, but you will need to paginate through it and access the refunds field inside the order object.
How does this query construct the URL?
It is not possible with bulk options according to my knowledge.
I tried to run the below query in bulk mutation but no luck.
{
orders(
reverse: true
query: "created_at:>'2023-04-16T00:00:00+05:00' AND created_at:<'2023-04-30T23:59:59+05:00'"
) {
edges {
node {
id
createdAt
updatedAt
name
closed
cancelledAt
displayFinancialStatus
paymentGatewayNames
refunds {
id
createdAt
note
refundLineItems {
edges {
node {
lineItem {
id
quantity
title
}
}
}
}
}
}
}
}
}
Shopify bulk mutation not having the capacity to run the above query and sent me following response against above query
Array
(
[data] => Array
(
[bulkOperationRunQuery] => Array
(
[bulkOperation] =>
[userErrors] => Array
(
[0] => Array
(
[field] => Array
(
[0] => query
)
[message] => Queries that contain a connection field within a list field are not currently supported.
)
)
)
)
[extensions] => Array
(
[cost] => Array
(
[requestedQueryCost] => 10
[actualQueryCost] => 10
[throttleStatus] => Array
(
[maximumAvailable] => 10000
[currentlyAvailable] => 9990
[restoreRate] => 500
)
)
)
)
Any one can help me ? How I can get the refunds lineitems. ? still working solution any person
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024