Hi! I'm attempting to create an order tracking page for my store. I have the code set up and it works. Or I should say it worked...
For some reason shopify started putting the following code into the text editor every time I save: // <![CDATA[
I take that code out, but when I click save, Shopify enters it back automatically. I'm not clicking back to the visual editor either. When I hit the save button, Shopify inputs the "cdata" code then automatically switches back to the visual editor.
It's strange because it didn't do this at first. I was able to save and the order tracking page worked fine. Here's the code I'm trying to put on the page in html:
The following article started to answer the question, but it got stranded: https://ecommerce.shopify.com/c/ecommerce-design/t/diable-auto-formatting-in-wysiwyg-editor-306015
So what can I do to prevent Shopify auto editing my code like this?
The Shopify RTE (Rich Text Editor) will try and correct formatting issues, close tags, etc. Right now it also adds CDATA wrappers around scripts too. Out of interest, what's the problem with the CDATA tags being added? Is something breaking?
If you must 100% not have that code added look into:
Hey thanks for the reply. Yes it breaks the script with that code added in. I click the button and basically nothing happens. The script doesn't fire.
Not really a coder but I'll look further into some of the suggestions you made.
Just ran into this problem with a client. They'd like to be able to add scripts to generic pages that are stored in the content field of the page. Unfortunately one of the tags is of type text/x-jsrender (“<script id="mediaTemplate" type="text/x-jsrender">), and these CDATA tags break the template in the script every time they click save.