Anchor to gateSubjectDeletegate
gateSubjectDelete
mutationDeprecated
Requires access scope. Also: You must have write access to
gates
to delete gate subjects.
Deletes a Gate Subject. Gates API is being sunset and will be removed in a future version. Use metafields
instead for gate configuration.
Anchor to Arguments
Arguments
- Anchor to inputinput•Gate
Subject requiredDelete Input! Specifies the input fields for a gate subject.
Was this section helpful?
Anchor to GateSubjectDeletePayload returnsGateSubjectDeletePayload returns
- Anchor to deletedGateSubjectIddeleted•
Gate Subject Id The ID of the deleted gate subject.
- Anchor to shopshop•Shop!non-null
The shop associated with the gate.
- Anchor to userErrorsuser•
Errors [GateSubject non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Delete a gate subject by ID
- Deleting a gateSubject by an incorrect ID returns an error
- gateSubjectDelete reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {
gateSubjectDelete(input: $input) {
userErrors {
field
message
}
deletedGateSubjectId
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/GateSubject/397454785"
}
},
},
);
const data = await response.json();
mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {
gateSubjectDelete(input: $input) {
userErrors {
field
message
}
deletedGateSubjectId
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation gateSubjectDelete($input: GateSubjectDeleteInput!) { gateSubjectDelete(input: $input) { userErrors { field message } deletedGateSubjectId } }",
"variables": {
"input": {
"id": "gid://shopify/GateSubject/397454785"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {
gateSubjectDelete(input: $input) {
userErrors {
field
message
}
deletedGateSubjectId
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/GateSubject/397454785"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {
gateSubjectDelete(input: $input) {
userErrors {
field
message
}
deletedGateSubjectId
}
}`,
"variables": {
"input": {
"id": "gid://shopify/GateSubject/397454785"
}
},
},
});
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 gateSubjectDelete($input: GateSubjectDeleteInput!) {
gateSubjectDelete(input: $input) {
userErrors {
field
message
}
deletedGateSubjectId
}
}
QUERY
variables = {
"input": {
"id": "gid://shopify/GateSubject/397454785"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"input": {
"id": "gid://shopify/GateSubject/397454785"
}
}
Response
JSON{
"gateSubjectDelete": {
"userErrors": [],
"deletedGateSubjectId": "gid://shopify/GateSubject/397454785"
}
}