How to undo Liquid code changes that messed up your online store

Michal17
Shopify Partner
835 73 175

How to undo Liquid code changes that messed up your online store

Have you ever made changes to your Shopify store theme – based on Liquid code copied online, only to find you’ve screwed up your online store with Liquid code errors? An online store in which you have invested massively has fallen because of some Liquid codes changes copied here and there on the internet. What an awful situation!

Your store was almost perfect until you found a disturbing detail that you wanted to fix. Being a resourceful online entrepreneur, you started looking for solutions until you found a tutorial explaining how to modify some Liquid code to achieve your goals. You were so happy that you found the perfect solution that you forgot to save your theme or a copy of the file where you are supposed to make the code changes.

You have followed the steps and done everything recommended in the tutorial. Here you are at the end! The moment of truth is not far away. You open a new tab, go to your online store, and bam, what happened?

Sample errors in Liquid codeSample errors in Liquid code

Liquid code errors are here! What did you really do?

What happened? How do you feel now that you have seen the surprise caused by your changes in the Liquid codes? Unfortunately, the changes you made to your online store (via the modified file) caused an error that prevented your store from working properly.

Sometimes the errors caused are not very serious, but it is always better not to have error messages on your online store for a better user experience. Therefore, how do you reverse your changes and get back to the code that was working fine?

How to get back to the code that was working fine?

Shopify knows that errors are human, so they have provided a way to undo changes made to a code file in your theme over time.

In case you have errors in your Liquid code, the first thing to do is to read the error message carefully to determine in which file and on which line the error occurred. If you look at the error on the image above, you will not know the exact file or line where the error occurred. In other words, some errors are not very expressive. In these cases, it is up to you to remember the files you modified when you were making your changes.

If you feel lost, make sure to take a screenshot of the error. Then post it in the Shopify community where experts, like those from Accomplishify, are always ready to help you. We are a Shopify development company in Melbourne.

If you can identify the file or line where the error occurred, I congratulate you. We can move on to the next step.

  • From your Shopify admin, go to Online Store > Themes.
  • Find the theme you want to edit, and then click Actions > Edit code.
  • Click on one of the files (under the relevant folder) in which you want to undo changes.

Theme code editor – ShopifyTheme code editor – Shopify

  • Click Older versions next to the file name

Files change history – ShopifyFiles change history – Shopify

  • Click the drop-down menu to select an older version. Clicking a datestamp will roll the code back to that saved version. If you remember when you made the changes, you can return to the state of the file before your changes.

File older versionsFile older versions

In my case, the changes that caused errors in this file were made after 2 AM. So, I’m going back to the version of 2:32 AM as shown below:

The relevant file older versionThe relevant file older version

The relevant file version to undo changes.The relevant file version to undo changes.

Please check your store and see the result. In my case:

Changes canceledChanges canceled

Well, here we are at the end of the tutorial that we hope has helped you. Although the method applied here is effective in undoing your changes, the best way to protect yourself is to always back up your theme before making any changes. Here are some other tutorials to help you more.

Have you ever experienced Liquid’s errors in your store? How did you fix them? Tell us about it.

Replies 0 (0)