How do I remove unnecessary code from the theme?
Hello @AnirbanRoy !
For your theme, the code can be accessed if you go to Online store > Theme and click on Actions > Edit code on your live theme. Before you go to edit the code, I recommend you also Duplicate the theme from that same drop down menu because this can be a backup in case something goes wrong.
Do you know what code you’re looking to remove? If this is some left over third party app code, you would need to contact the app developers directly as the know their app code and will be able to best assist you here.
Otherwise, while our own support is limited when it comes to editing the code, however do let me know what it is that you’re looking to remove and we’ll see what can be done. If it is something that is out of the scope of our support, an option for you would be to contact a Shopify Expert. Shopify Experts are people who work externally to Shopify and charge their rates based on the work that they do. They can help when it comes to any kind of coding issues or questions.
Is there a reason you are looking to do this? Removing unnecessary or left over code is a great way to increase the speed of your store. If you’re looking for some other ways to do this, I have a help doc here on how else you can improve your site speed.
Firstly you have to find the unnecessary code from your store, then duplicate your theme or make a copy of it and work on this so that your backup will be ready if any challenges come. Any extra apps you’re not using? Remove them from your store.
If you have to remove the unused code then you may have to be very sure about the code before removing it. else you will need to have the Shopify expert.
have you checked your store with the page insight tool?
for better performance work on these points
- Theme Upgrade if there is a scope and upgraded theme available
- Reduce JS Payload.
- Use Critical CSS.
- Reduce Large Image Sizes
- Compress Images
- Limit Third-Party JavaScript & Shopify Apps
- Preload Web Fonts.
- I would suggest limiting to one and using a standard web font.
By fixing these issues, your website speed score can definitely improve.
For more details please check the link below.
https://www.oscprofessionals.com/shopify-performance-optimization/
If anything is missed out or unclear then don’t hesitate to ask. Email us or Connect with us on Skype
Have a nice day !
@AnirbanRoy Hello, most of it was said by @oscprofessional .
Usually it takes a quite experienced web-developer like me, or js-coder or frontend-coder to see what’s wrong in theme files.
That’s why most of us stay away from bloated themes, themes that load tons of external scripts with no need, lots of JavaScript execution with no real need, things like that.
You can have a look at that with DOM Content Loaded, something everyone can check with Google or Safari (Google Chrome or Safari > right click anywhere on screen > Inspect > Network Tab > Reload to check Dom Content Loaded speed vs Dom Content full loaded). Dom Content Loaded is the real deal as the first time to interaction.
Have fun with Shopify,
Hi @AnirbanRoy This is Alex from MS Web Designer.
Kindly share your store URL so that we can make an audit of your website in terms of speed.
Thanks
Alex