Anchor to giftCardDisablegift
giftCardDisable
mutationDeprecated
Requires access scope.
Disable a gift card. A disabled gift card cannot be used by a customer. A disabled gift card cannot be re-enabled. Use instead.
Anchor to Arguments
Arguments
- •ID!required
The ID of the gift card to disable.
Was this section helpful?
Anchor to GiftCardDisablePayload returnsGiftCardDisablePayload returns
- Anchor to giftCardgift•
Card The disabled gift card.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Disable a gift card by ID
- giftCardDisable reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation giftCardDisable($id: ID!) {
giftCardDisable(id: $id) {
userErrors {
message
field
}
giftCard {
id
enabled
}
}
}`,
{
variables: {
"id": "gid://shopify/GiftCard/63396415"
},
},
);
const data = await response.json();
mutation giftCardDisable($id: ID!) {
giftCardDisable(id: $id) {
userErrors {
message
field
}
giftCard {
id
enabled
}
}
}
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 giftCardDisable($id: ID!) { giftCardDisable(id: $id) { userErrors { message field } giftCard { id enabled } } }",
"variables": {
"id": "gid://shopify/GiftCard/63396415"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation giftCardDisable($id: ID!) {
giftCardDisable(id: $id) {
userErrors {
message
field
}
giftCard {
id
enabled
}
}
}`,
{
variables: {
"id": "gid://shopify/GiftCard/63396415"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation giftCardDisable($id: ID!) {
giftCardDisable(id: $id) {
userErrors {
message
field
}
giftCard {
id
enabled
}
}
}`,
"variables": {
"id": "gid://shopify/GiftCard/63396415"
},
},
});
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 giftCardDisable($id: ID!) {
giftCardDisable(id: $id) {
userErrors {
message
field
}
giftCard {
id
enabled
}
}
}
QUERY
variables = {
"id": "gid://shopify/GiftCard/63396415"
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"id": "gid://shopify/GiftCard/63396415"
}
Response
JSON{
"giftCardDisable": {
"userErrors": [],
"giftCard": {
"id": "gid://shopify/GiftCard/63396415",
"enabled": false
}
}
}