Skip to main content
mutation

Requires write_products access scope. Also: The user must have a permission to delete products.

Permanently deletes a product and all its associated data, including variants, media, publications, and inventory items.

Use the productDelete mutation to programmatically remove products from your store when they need to be permanently deleted from your catalog, such as when removing discontinued items, cleaning up test data, or synchronizing with external inventory management systems.

The productDelete mutation removes the product from all associated collections, and removes all associated data for the product, including:

  • All product variants and their inventory items
  • Product media (images, videos) that are not referenced by other products
  • Product options and option values
  • Product publications across all sales channels
  • Product tags and metadata associations

The productDelete mutation also has the following effects on existing orders and transactions:

  • Draft orders: Existing draft orders that reference this product will retain the product information as stored data, but the product reference will be removed. Draft orders can still be completed with the stored product details.
  • Completed orders and refunds: Previously completed orders that included this product aren't affected. The product information in completed orders is preserved for record-keeping, and existing refunds for this product remain valid and processable.

Caution

Product deletion is irreversible. After a product is deleted, it can't be recovered. Consider archiving or unpublishing products instead if you might need to restore them later.


If you need to delete a large product, such as one that has many variants that are active at several locations, you might encounter timeout errors. To avoid these timeout errors, you can set the synchronous parameter to false to run the deletion asynchronously, which returns a ProductDeleteOperation that you can monitor for completion status.

If you need more granular control over product cleanup, consider using these alternative mutations:

Learn more about the product model.

•ProductDeleteInput!
required

Specifies the product to delete by its ID.

•Boolean
Default:true

Specifies whether or not to run the mutation synchronously.


Was this section helpful?

Anchor to ProductDeletePayload returnsProductDeletePayload returns

•ID

The ID of the deleted product.

Anchor to productDeleteOperationproductDeleteOperation
•ProductDeleteOperation

The product delete operation, returned when run in asynchronous mode.

•Shop!
non-null

The shop associated with the product.

•[UserError!]!
non-null

The list of errors that occurred from executing the mutation.


Was this section helpful?