# productDelete - admin - MUTATION
Version: 2024-07

## Description
Deletes a product, including all associated variants and media.

As of API version `2023-01`, if you need to delete a large product, such as one that has many
[variants](https://shopify.dev/api/admin-graphql/latest/input-objects/ProductVariantInput)
that are active at several
[locations](https://shopify.dev/api/admin-graphql/latest/input-objects/InventoryLevelInput),
you may encounter timeout errors. To avoid these timeout errors, you can instead use the asynchronous
[ProductDeleteAsync](https://shopify.dev/api/admin-graphql/latest/mutations/productDeleteAsync)
mutation.

### Access Scopes
`write_products` access scope. Also: The user must have a permission to delete products.


## Arguments
* [input](/docs/api/admin/2024-07/input-objects/ProductDeleteInput): ProductDeleteInput! - Specifies the product to delete by its ID.


## Returns
* [deletedProductId](/docs/api/admin/2024-07/scalars/ID): ID The ID of the deleted product.
* [shop](/docs/api/admin/2024-07/objects/Shop): Shop! The shop associated with the product.
* [userErrors](/docs/api/admin/2024-07/objects/UserError): UserError! The list of errors that occurred from executing the mutation.


## Examples
### Delete a non-existent product
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation { productDelete(input: {id: \\\"gid://shopify/Product/-1\\\"}) { deletedProductId userErrors { field message } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `mutation {\n    productDelete(input: {id: \"gid://shopify/Product/-1\"}) {\n      deletedProductId\n      userErrors {\n        field\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    productDelete(input: {id: \"gid://shopify/Product/-1\"}) {\n      deletedProductId\n      userErrors {\n        field\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    productDelete(input: {id: \"gid://shopify/Product/-1\"}) {\n      deletedProductId\n      userErrors {\n        field\n        message\n      }\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation {\n  productDelete(input: {id: \"gid://shopify/Product/-1\"}) {\n    deletedProductId\n    userErrors {\n      field\n      message\n    }\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "productDelete": {
      "deletedProductId": null,
      "userErrors": [
        {
          "field": [
            "id"
          ],
          "message": "Product does not exist"
        }
      ]
    }
  }
}

### Delete a product
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation { productDelete(input: {id: \\\"gid://shopify/Product/108828309\\\"}) { deletedProductId } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: `mutation {\n    productDelete(input: {id: \"gid://shopify/Product/108828309\"}) {\n      deletedProductId\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    productDelete(input: {id: \"gid://shopify/Product/108828309\"}) {\n      deletedProductId\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    productDelete(input: {id: \"gid://shopify/Product/108828309\"}) {\n      deletedProductId\n    }\n  }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation {\n  productDelete(input: {id: \"gid://shopify/Product/108828309\"}) {\n    deletedProductId\n  }\n}"
#### Graphql Input
null
#### Graphql Response
{
  "data": {
    "productDelete": {
      "deletedProductId": "gid://shopify/Product/108828309"
    }
  }
}