Shopify App: Remove product automatically on uninstall?

Hi All,

I have an embedded Shopify app that creates a product in the merchant’s store (via the Admin API) and uses an app block to let merchants add it to their storefront.

The problem: if a merchant uninstalls my app via the Shopify admin (not my in-app uninstall button), Shopify immediately revokes my API token. That means I can’t run any cleanup calls to delete the product, so it stays in their store.

Has anyone found a reliable workaround for this? Is there any pattern or trick to ensure a product gets deleted (or made un-purchasable) after the app is uninstalled?

Cheers.

Hi @cameron_CN

This is a known limitation when merchants delete an app via the admin, as you lose API access before being able to respond with clean u actions. Some strategies you could try are:

  • When you create a product, add a unique tag or metafield (e.g., app_owned:true).
  • If you cannot delete the product after uninstall, at least you (or the merchant) can later identify and manually remove or hide these products.
  • You can also provide a public-facing tool or instructions for merchants to clean up orphaned products.
  • Provide a cleanup script or instructions for merchants to run after uninstall, or offer a “reinstall to clean up” flow.
1 Like

Hi @Liam-Shopify

Thanks for the reply!

Yes — I already have those strategies in place :slightly_smiling_face:

My main concern is whether a merchant who uses my app might continue selling the product after uninstalling it. Are there any other strategies you’d recommend?

Also, is it possible to link billing to a specific product so that, once billing is removed, the product is removed as well?

Cheers!