How do I delete metafields on app uninstall

My App creates metafields, potentially thousands, scoped to avoid collisions.
I feel that I should delete all the metafields created by the app if the app is uninstalled by the merchant.
I would do this on the APP_UNINSTALLED webhook.

Unluckily the access token becomes invalid upon app uninstall and it is not available in the web hook and therefore I cannot access the metafields anymore.

Are you guys at Shopify providing a solution soon or are you going to allow us to foul for ever your customers and products, etc. with stale metafields?

5 Likes

Way back in the day, metafields created by an App were automatically removed when the App was uninstalled. This was a handy way to enable functionality only if your app was still installed.

Are you guys at Shopify providing a solution soon

I wouldn’t hold your breath on that one. I’ve been trying to get it changed for years now.

Ideally, I’d like to be able to pass a flag through when creating the metafield to indicate if it should be cleaned up or not when the App is uninstalled. Or it could be a setting in the partner’s app page.

1 Like

Two years later … is there a solution for this now? I can’t use private metafields.

Can we delete these definitions in the APP_UNINSTALLED webhook of a Remix app?

1 Like