Anchor to returnDeclineRequestreturn
returnDeclineRequest
mutation
Requires access scope or
access scope. Also: Requires the
access scope. The user must have
permission.
Declines a return on an order.
When a return is declined, each can be associated to a new return.
Use the
or
mutation to initiate a new return.
Anchor to Arguments
Arguments
- Anchor to inputinput•Return
Decline requiredRequest Input! The input fields for declining a customer's return request.
Was this section helpful?
Anchor to ReturnDeclineRequestPayload returnsReturnDeclineRequestPayload returns
- Anchor to returnreturn•
The declined return.
- Anchor to userErrorsuser•
Errors [ReturnUser non-nullError!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Cannot decline a return that has been refunded
- Cannot decline a return with an invalid status
- Decline a return
- returnDeclineRequest reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {
returnDeclineRequest(input: $input) {
return {
id
status
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/Return/491427904",
"declineReason": "RETURN_PERIOD_ENDED"
}
},
},
);
const data = await response.json();
mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {
returnDeclineRequest(input: $input) {
return {
id
status
}
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 ReturnDeclineRequest($input: ReturnDeclineRequestInput!) { returnDeclineRequest(input: $input) { return { id status } userErrors { code field message } } }",
"variables": {
"input": {
"id": "gid://shopify/Return/491427904",
"declineReason": "RETURN_PERIOD_ENDED"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {
returnDeclineRequest(input: $input) {
return {
id
status
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/Return/491427904",
"declineReason": "RETURN_PERIOD_ENDED"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {
returnDeclineRequest(input: $input) {
return {
id
status
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"input": {
"id": "gid://shopify/Return/491427904",
"declineReason": "RETURN_PERIOD_ENDED"
}
},
},
});
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 ReturnDeclineRequest($input: ReturnDeclineRequestInput!) {
returnDeclineRequest(input: $input) {
return {
id
status
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"input": {
"id": "gid://shopify/Return/491427904",
"declineReason": "RETURN_PERIOD_ENDED"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"input": {
"id": "gid://shopify/Return/491427904",
"declineReason": "RETURN_PERIOD_ENDED"
}
}
Response
JSON{
"returnDeclineRequest": {
"return": null,
"userErrors": [
{
"code": "INVALID_STATE",
"field": [
"input",
"id"
],
"message": "Return is not declinable. Only non-refunded returns with status REQUESTED can be declined."
}
]
}
}