I review a lot of Shopify stores each week.
One thing that comes up time and time again is old code lying around from apps that have been uninstalled.
For back office only apps like my Repeat Customer Insights that don't touch the storefront, uninstalling is simple and clean. It's rare that code gets left behind.
But for apps that have to be in the storefront, visible to customers, or that need theme edits, things get tricky.
Sometimes this code is useful to keep around post-uninstall (like in JSON-LD for SEO's case) or sometimes the code doesn't run after the app is removed, but other times it can cause problems.
The reason Shopify apps leave old code around is because of how Shopify works when you uninstall an app.
From the moment an app is uninstalled in Shopify's admin area, Shopify blocks the app from doing anything in your store. That means apps aren't given the chance to cleanup or remove anything even if they wanted to.
There really isn't a good solution to this problem.
The best one I've found is two-fold:
- apps need to provide easy to find and clear directions on how to clean things up after uninstalling
- you and your team need to remember to find and follow the full uninstall directions
It might also be a good time to give your store a spring summer cleaning and ask your theme developer to double-check for any stray code.