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
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"
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-04/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
JSON{
"input": {
"id": "gid://shopify/Return/945000959"
}
}
Response
JSON{
"returnApproveRequest": {
"return": {
"id": "gid://shopify/Return/945000959",
"name": "#1001-R1",
"status": "OPEN",
"returnLineItems": {
"edges": [
{
"node": {
"id": "gid://shopify/ReturnLineItem/677614676"
}
}
]
},
"order": {
"id": "gid://shopify/Order/311154583"
}
},
"userErrors": []
}
}