I have created an app that can enable Coming soon tag for products at the store. Everything is working fine, but the problem occurs when a user uninstalls the app. Our file remains in the user's liquid file structure and even after deleting the app, a user can use all the app features as Files are still present in the liquid file structure. From past certain days, I am trying to figure this out but unfortunately not find any best way for doing this.
I tried to do this by using webhook API but when a user uninstalls the app, That very first moment the access token expires and without valid access token we can not fire Shopify's delete file API https://help.shopify.com/en/api/reference/online-store/asset#destroy-2020-01
Can anyone suggest the best way to delete inserted files from liquid file structure when a user uninstalls our app? (We tried the webhook api but once the access token expires, We can not code further.)
I am totally stuck and clueless regarding this issue.
If anyone can help with me that would be really appreciated.
Thanks in advance.
You don't get to keep your access scopes on app removal.
Even if you did, that won't help you when it comes to a theme export or simple theme or file duplication.
Instead of injecting or editing Liquid files perhaps look into using ScriptTags.
What does the app do?
Thanks for your response.
Our app adds a script tag to products and creates the "Coming Soon" label on whichever products admin selects. I have used liquid asset API to insert and update some files of the liquid file structure. Apart from this, I am also having two more apps in which I want to delete our added files from Shopify theme structure whenever a user uninstalls our app, Otherwise, a user will delete our app but the access will remain to him until he deletes the files from his side.
Any better solution regarding this?
Thanks in advance.
Hi @Jason, I'm also having the same scenario. I just want to remove my liquid file before / after installed my App. I want to remove programmatically not manually.. Please help me to do this.
Thanks In Advance,