Joint session with Vercel: How to build intelligent storefronts (May 15th)

How to fix Shopify sync error after removing store and token from Sanity?

21 repliesLast updated: Nov 29, 2025

Hi guys,
Yesterday I tryed shopify connect with sanity, and I removed the store and token but now I get this when I try to delete some of the products. How can resolve this?
AI Update

This 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:

Find the referencing documents

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.

Remove the references

You have a few options:

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.

Show original thread
21 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

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.

Related contributions