
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a common issue that happens when Shopify Connect creates documents with references between them, and then you disconnect Shopify but the references remain in your Sanity dataset.
The error message is telling you that the product you're trying to delete is referenced by 2 other documents. Sanity prevents you from deleting documents that are referenced elsewhere as a safety measure to maintain data integrity.
Here's how to resolve this:
Use the Vision plugin in your Studio to find all documents that reference the one you're trying to delete. Run this GROQ query:
*[]{_id, title, "references":*[references(^._id)]}[length(references)>0]This will show you which documents are holding references to the document you want to delete.
You have a few options:
Through the Studio UI: Open each referencing document and manually remove the reference fields. However, based on the thread you linked, it sounds like the Studio might crash when trying to access these documents.
Delete the referencing documents first: If you don't need those documents either, delete them first, then delete the product.
Use a migration script: If the Studio crashes or you have many references to clean up, you can write a migration script to programmatically unset the references or delete the documents.
Nuclear option: As mentioned in the thread, if this is a development project and you don't need any of the data, you can delete the entire dataset and start fresh through your project settings at manage.sanity.io.
The most likely scenario is that Shopify Connect created product variant documents or image asset documents that reference each other, and those references need to be cleaned up before deletion is possible.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store