There are many ways to customize the functionalities of your WooCommerce website, and Business Bloomer is the living proof, with hundreds of WooCommerce snippets!
However, many developers totally underestimate the pros and cons of each different method for adding custom code to a WordPress website. Someone is familiar with the WordPress editor, others tend to install “Code Snippets” plugins to make things easier for them and the website owner (on paper), others exclusively use FTP / SFTP or more advanced methods.
So, today I want to remind you what is the ONLY way you should be customizing WordPress from now on.
Before we pick a customization method…
There is no doubt if you’re about to customize a WordPress website, and even more importantly a WooCommerce website, you need a child theme.
Building a child theme can take about 10 minutes – you only need to create 2 files with a few lines of CSS (style.css) and PHP (functions.php).
Here’s a quick and free video lesson for you: “Where to Place WooCommerce Customization?“
PHP Customization Method 1: WP Editor
WordPress contains a built-in editor that allows you to edit theme files directly from your browser. You can access the WP Editor from the WordPress Dashboard > Appearance > Theme File Editor (unless you have a security plugin such as WordFence, which disables that for obvious reasons).
Even if you have a child theme, using the WP Editor for PHP customization is not a good idea. In fact, the changes you make to the functions.php file are instant and permanent – you can’t just hit the “back” button to go back to the previous version in case you’ve messed up with code.
You can’t even create new files or folders, move them, delete them. You can’t upload or download them. Ypu’re basically only able to edit a file at a time.
You can’t search and replace, and do usual dev operations with it.
On the other hand, no need to worry if you forget a simple comma – your WordPress site won’t break (Error 500) and you will be returned with an error message describing the error.
Either way, I recommend not to use the WP Editor for PHP customization.
PHP Customization Method 2: FTP
FTP is the best way to customize your WordPress/WooCommerce website.
You can open the files in your favorite text editor (I use Visual Code Editor), do the edits there, save a backup and if you break something you can immediately correct / rename / comment out the PHP function or entire file.
Whenever you do work on live websites (like I do), always make sure to ask for the WP login/password as well as the FTP credentials. And remind the client you will not start working until you get the FTP details!
PHP Customization Method 3: “Code Snippets” Plugin
The Code Snippets plugin is super handy when you don’t have a child theme (why would you not have one though?) or when you want to test / run just a couple of PHP snippets.
It’s interface is awesome and easy to use, including the enabling/disabling snippets and your website will not go down if you forget a comma… the plugin will tell you what the problem is and disable the snippet without breaking the website.
The problem is that you won’t be able to find the snippets via FTP or File Manager, as the plugin stores them in the WordPress database. If your website goes down for other problems (a plugin conflict for example), it’s super difficult to disable a code snippet from outside of WordPress – you need to login to your database, find the code snippets table, drop a row and hope that you didn’t mess with anything else. Playing with the database is something you should never do.
Conclusion
If you want to become a serious advanced WooCommerce developer, you need to become super familiar with child themes and FTP software.
Genial y excelente lección “Where to Place Customization” 🙂
Thanks!
Hi Rodolfo – if you would like to use the codes snippets plugin & it still breaks your site, you can always add this snippet to ‘wp-config.php’.
This activates the plugin’s safe mode, enabling you to change/remove the snippet that broke the site instantly.
Awesome!
Most useful Information for those who do php edits frequently !
Thank you!