Anchor to returnApproveRequestreturn
returnApproveRequest
mutation
Requires access scope or
access scope. Also: The user must have
permission.
Approves a customer's return request.
If this mutation is successful, then the Return.status
field of the
approved return is set to .
Anchor to Arguments
Arguments
- Anchor to inputinput•Return
Approve requiredRequest Input! The input fields to approve a return.
Was this section helpful?
Anchor to ReturnApproveRequestPayload returnsReturnApproveRequestPayload returns
- Anchor to returnreturn•
The approved return.
- Anchor to userErrorsuser•
Errors [ReturnUser non-nullError!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Approve a return
- Cannot approve a return with an invalid status
- returnApproveRequest reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {6 returnApproveRequest(input: $input) {7 return {8 id9 name10 status11 returnLineItems(first: 1) {12 edges {13 node {14 id15 }16 }17 }18 order {19 id20 }21 }22 userErrors {23 code24 field25 message26 }27 }28 }`,29 {30 variables: {31 "input": {32 "id": "gid://shopify/Return/945000959"33 }34 },35 },36);3738const data = await response.json();39
mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
returnApproveRequest(input: $input) {
return {
id
name
status
returnLineItems(first: 1) {
edges {
node {
id
}
}
}
order {
id
}
}
userErrors {
code
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) { returnApproveRequest(input: $input) { return { id name status returnLineItems(first: 1) { edges { node { id } } } order { id } } userErrors { code field message } } }",
"variables": {
"input": {
"id": "gid://shopify/Return/945000959"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
returnApproveRequest(input: $input) {
return {
id
name
status
returnLineItems(first: 1) {
edges {
node {
id
}
}
}
order {
id
}
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/Return/945000959"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
returnApproveRequest(input: $input) {
return {
id
name
status
returnLineItems(first: 1) {
edges {
node {
id
}
}
}
order {
id
}
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"input": {
"id": "gid://shopify/Return/945000959"
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation ReturnApproveRequest($input: ReturnApproveRequestInput!) {
returnApproveRequest(input: $input) {
return {
id
name
status
returnLineItems(first: 1) {
edges {
node {
id
}
}
}
order {
id
}
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"input": {
"id": "gid://shopify/Return/945000959"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "input": {3 "id": "gid://shopify/Return/945000959"4 }5}
Response
JSON1{2 "returnApproveRequest": {3 "return": {4 "id": "gid://shopify/Return/945000959",5 "name": "#1001-R1",6 "status": "OPEN",7 "returnLineItems": {8 "edges": [9 {10 "node": {11 "id": "gid://shopify/ReturnLineItem/677614676"12 }13 }14 ]15 },16 "order": {17 "id": "gid://shopify/Order/311154583"18 }19 },20 "userErrors": []21 }22}