Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to trigger a function after app/uninstall

How to trigger a function after app/uninstall

Harelk1015
Shopify Partner
46 1 6

I have created an app that creates products for the users, and i want to add the functionality that will remove all the product that were created with my app when users remove the app from their shop.

i tried using the app/uninstall web hook and sent an http request to remove all the products that were created with the app (I stored all of the id's), but i got the error that the session that im providing is no longer available - 

errors: '[API] Invalid API key or access token (unrecognized login or wrong password)'

I guess thats makes sense because the app is no longer installed.

Does anyone know if there is a way that i will be able to remove the product that were added to the shop using my app? if its by triggering a function upon removal or adding a tag or something, Please help : 

Replies 2 (2)

jordanholmes
Shopify Partner
152 28 34

Hello,

 

This is a long time problem that I think the only solution is to provide a button for the merchant to click to remove all products BEFORE they uninstall. If they uninstall first then there is not much you can do

Jordan Holmes
Shopify Expert and Ruby on Rails Developer
Shopify Partner Directory
Harelk1015
Shopify Partner
46 1 6

I understand,
The problem is that my whole app functionality is helping users create products, so they can just download the app and stay on the one day free trial, import as many products as they want and just remove them.

I heard that there is a way to remove the product as the user uninstalls, maybe you know if there is different way ?