Day to day, the majority of code changes we make are to existing sites.
The flow for working on new sites via FTP works fairly well, you can make changes and not worry as it's not live yet.
But once that site goes live, that site will need maintaining & you'll still need to make changes from time to time,
so how do you do that without making the changes live and affecting the live site?
Introducing the new Fork, Edit, Preview & Flatten flow (long name but hear us out).
This flow is entirely optional by the way, feel free to edit sites as you always have.
But, if you want to make changes to a site, like make a few text changes that you want to try out first,
or you want to add a new feature or modify template files, this flow is for you.
Let's walk through an example edit,
we want to try changing the "add to cart" buttons to say "Buy it!"
Head to Admin > Templates as normal, and you'll find a new "Fork Active Template" button to the top right.
Click this and it'll ask for a new template name, we'll call this "trial-add-to-cart-change" (use dashes instead of spaces as this creates a folder with this name).
Once the template is forked, you're ready to start editing and you're already in a preview.
For our change we want to find those add to cart buttons so we'll search for "add to cart".
At first this will probably show lots of results as that phrase is mentioned in many comments, so let's be a bit more specific.
The button reads "Add to Cart" (notice that capitalization) so let's enter this and untick the "Ignore case?" tickbox,
this should now give you a single result for the button code.
Click the filename to jump to the line of code where this appears.
Now we're here we can make the change, but you might be about to edit the live/parent template so check the folder name shown.
An easy way to tell is there will be a button to "extend" the file to the top right if you're not in your preview template,
click to extend before making edits.
All your changes to the fork template are made in a preview session,
this tends to last a day or until you're logged out and you can see you're in a preview by the indicator to the top left of admin.
You can also send your preview to others so they can see too,
check out the "Share preview URL" input under the tree of template files.
There's also another url to quickly clear / leave the preview at any time.
Ready to make that change live? Click Flatten, it'll warn you that this template will override the parent one,
if you're happy with the change then click ok to continue.
What's next? Dive in and have fun making changes in the preview without affecting the live site!
Do you have any ideas to make this flow more useful?
Let us know via the feature requests area, or message us via the support system.