# discountCodeDelete - admin-graphql - MUTATION Version: 2025-01 ## Description Deletes a [code discount](https://help.shopify.com/manual/discounts/discount-types#discount-codes). ### Access Scopes Apps must have `write_discounts` access scope. ## Arguments * [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID! - The ID of the code discount to delete. ## Returns * [deletedCodeDiscountId](/docs/api/admin-graphql/2025-01/scalars/ID): ID The ID of the code discount that was deleted. * [userErrors](/docs/api/admin-graphql/2025-01/objects/DiscountUserError): DiscountUserError! The list of errors that occurred from executing the mutation. ## Examples ### Delete an amount off discount Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation { discountCodeDelete(id: \\\"gid://shopify/DiscountCodeNode/206265824\\\") { deletedCodeDiscountId userErrors { field code message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n discountCodeDelete(id: \"gid://shopify/DiscountCodeNode/206265824\") {\n deletedCodeDiscountId\n userErrors {\n field\n code\n message\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 {\n discountCodeDelete(id: \"gid://shopify/DiscountCodeNode/206265824\") {\n deletedCodeDiscountId\n userErrors {\n field\n code\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n discountCodeDelete(id: \"gid://shopify/DiscountCodeNode/206265824\") {\n deletedCodeDiscountId\n userErrors {\n field\n code\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n discountCodeDelete(id: \"gid://shopify/DiscountCodeNode/206265824\") {\n deletedCodeDiscountId\n userErrors {\n field\n code\n message\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "discountCodeDelete": { "deletedCodeDiscountId": "gid://shopify/DiscountCodeNode/206265824", "userErrors": [] } } }