How to delete a file when the app is uninstalled?

How to delete a file when the app is uninstalled?

Anjali-Maru
Tourist
32 0 3

How to delete a file into the theme when the user uninstalls the app in the Shopify store. I have tried to delete files and delete code into an existing file when the user uninstalls my Shopify app.

Replies 8 (8)

Ivy
Shopify Staff
1033 82 137

Hi @Anjali-Maru.

Can you clarify for me please: Are you a store owner trying to remove app code from your store, or are you a Shopify app partner trying to carry out code removal of your app from a third party's store code?

If you are a store owner trying to remove app code - in this case, the best thing to do is to reach out to our live support team so they can create a request with the app developers for them to remove all traces of code from your store. This is only possible for apps found on our official Shopify App Store. Our live support via phone, chat or email can be reached via our support portal here

If you are an App partner/developer trying to remove app code from a third party store, this is quite advanced coding beyond out scope of support but I have found this previous community post that may be helpful for you. 

 

Ivy | Social Care @ Shopify


Out Of Office

-Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog



Anjali-Maru
Tourist
32 0 3

Hii @Ivy 

 

I am a laravel developer and new to Shopify. I have created my app in laravel and integration for laravel and Shopify I am using the addon.
when a user installs my app in their store then my custom file adds in the user main theme. now I have tried to delete code into an existing file and delete my custom file when the user uninstalls my Shopify app.

Ivy
Shopify Staff
1033 82 137

I am not familiar with Laravel - is this an Official Shopify App store supported App?

Creating apps for Shopify store's is best done via our Official App Store/ Partner program as this provides you with our full Partner support if needed. 

Ivy | Social Care @ Shopify


Out Of Office

-Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog



Anjali-Maru
Tourist
32 0 3

Hii @Ivy 

 

Yes, I am created an app on the store via Shopify partner account but my app backend in laravel 

Jason
Shopify Partner
11206 226 2314

Once the app is removed, any scopes it had to alter files is also removed. In the case that this will leave leftover files is best practice to provide some clear manual uninstallation instructions for your users.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Anjali-Maru
Tourist
32 0 3

@Jason 

Yes, I have sent to the mail user for file delete but I want to find another way to file delete on their theme 

Jason
Shopify Partner
11206 226 2314

There isn't. It's important that an app no longer has scope to alter a shop - or a theme - after a user chooses to uninstall. A small mess is better than an auto delete process that could leave the shop in a broken state. If your app is creating files vs using script tags than a level of manual clean up may be needed. 

I suppose you could add a "delete added files" button into the settings of your app so a user could do some cleaning before doing the actual uninstallation. If you added that, best you also include a way to put the files back should something break. It's possible for merchants to alter and edit all files to add custom logic into whatever files your app added. Assuming deletion is safe is not a recommend line of thinking.

 

What is your app adding that can't be a script tag?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
den232
Shopify Partner
220 8 56

Hi ... a related issue ...  I am building the uninstall feature for my (new) app.

 

A merchant taps my button to say "uninstall this app" ...

 

First, I will do some metafield (etc) cleanup to his store, then want to do the actual uninstall.  I see some references to how to do this using the rest API, such as https://shopify.dev/docs/apps/build/authentication-authorization/app-installation/uninstall-app-api-... but that API is going away soon, so would not be a brilliant choice ... right?

 

How can I do the actual uninstall by another API?

 

Thanks!  jb