# gateSubjectDelete - admin - MUTATION Version: unstable ## Description Deletes a Gate Subject. ### Access Scopes `write_gates` access scope. Also: You must have write access to `gates` to delete gate subjects. ## Arguments * [input](/docs/api/admin/unstable/input-objects/GateSubjectDeleteInput): GateSubjectDeleteInput! - Specifies the input fields for a gate subject. ## Returns * [deletedGateSubjectId](/docs/api/admin/unstable/scalars/ID): ID The ID of the deleted gate subject. * [shop](/docs/api/admin/unstable/objects/Shop): Shop! The shop associated with the gate. * [userErrors](/docs/api/admin/unstable/objects/GateSubjectUserError): GateSubjectUserError! The list of errors that occurred from executing the mutation. ## Examples ### Delete a gate subject by ID Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation gateSubjectDelete($input: GateSubjectDeleteInput!) { gateSubjectDelete(input: $input) { userErrors { field message } deletedGateSubjectId } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/397454785\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/397454785\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/397454785\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/397454785\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n}" #### Graphql Input { "input": { "id": "gid://shopify/GateSubject/397454785" } } #### Graphql Response { "data": { "gateSubjectDelete": { "userErrors": [], "deletedGateSubjectId": "gid://shopify/GateSubject/397454785" } } } ### Deleting a gateSubject by an incorrect ID returns an error Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation gateSubjectDelete($input: GateSubjectDeleteInput!) { gateSubjectDelete(input: $input) { userErrors { field message } deletedGateSubjectId } }\",\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/0\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n }`,\n \"variables\": {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/0\"\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/0\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n }`,\n {\n variables: {\n \"input\": {\n \"id\": \"gid://shopify/GateSubject/0\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation gateSubjectDelete($input: GateSubjectDeleteInput!) {\n gateSubjectDelete(input: $input) {\n userErrors {\n field\n message\n }\n deletedGateSubjectId\n }\n}" #### Graphql Input { "input": { "id": "gid://shopify/GateSubject/0" } } #### Graphql Response { "data": { "gateSubjectDelete": { "userErrors": [ { "field": [ "input", "id" ], "message": "Gate subject not found." } ], "deletedGateSubjectId": null } } }