Can anyone help me i accidentally deleted a file when trying to add product reviews and now when i click a product it says Liquid error: Error in tag ‘section’ - ‘product-template’ is not a valid section type
This is Moira from the Social Care team at Shopify.
I understand you accidentally deleted a file when trying to install the Product Reviews app which has caused a liquid error on your storefront. You’ve definitely posted in the right place! I’m more than happy to look into this for you. Shopify knows that errors are just human nature, so we 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 here in the Shopify community where experts, are always ready to help you. Seeing as you have identified the file where the error occurred (tag section in the product-template.liquid) we can move on to the next steps.
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. In this case, you want to head to Sections > Product-template.liquid.
If you remember when you made the changes, you can return to the state of the file before your changes. Finally, don’t forget to hit the green save button!
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 is another tutorial where a few Shopify Experts have provided a coding solution to solve the liquid error you are experiencing in the debut theme. Depending on which theme you have will determine which backup code can be copied into your product-template.liquid.
As you continue to develop and edit your store, I highly suggest taking advantage of the Shopify Developers website. This is a place where our developers post hundreds of step-by-step coding tutorials which is a great way to familiarise yourself with all the different customization possibilities within your theme!
If you have any questions please feel free to thread those below.