01 Jun Need to customize WordPress and Woocommerce
WordPress and woocommerce both comes with a great functionality and a number of dynamic features.One gets a lot of predefined stuff to play with them but when it comes to Think-Out-the-Box, Customization comes into existence.Different requirements lead to specific modifications or additions in the prepacked theme’s or plugin’s code snippet so that the requirements are met efficiently.
The best thing about WordPress and WooCommerce is code and content can be changed to suit — modify and customize your website entirely.
One may need to customize WordPress or Woocommerce for enhancing features, for deleting unwanted features or decreasing file size or any other reason.
Besides custom code, WordPress offers a number of plugins to meet the requirements but…
Yes, that two-word sentence is the short answer to the question,”Should I custom code or use a plugin?”
Let’s have a look over customization of WordPress and Woocommerce separately.
If You’ve Installed a Theme Someone Else Made…
then adding custom code to theme’s file is not considered as a good practice because As soon as you update the core, plugin, or theme, your changes will be wiped out and hence a total time loss.
For the Purpose being served,
Creating a Child Theme is the best practice.
child themes let you “use hooks that are specific to WordPress and themes […] to insert your code.
Fortunately, creating a child theme is a piece of cake – all you need to do is create one folder, and one file.
Click Here for a review of complete process
Once the Child theme files are created, add the required code snippets to it and you are all set to stream around.
WooCommerce holds the crown of “most downloaded WordPress eCommerce plugin” with over seven million downloads till the date. Reason is the best compliance with WordPress core and best eCommerce features.
WooCommerce simply adds an eCommerce functionality to a particular WordPress theme. Some WordPress themes are already optimized for WooCommerce specifically, meaning that they have simply styled and added custom PHP to allow a more “natural” integration to the given theme. WooCommerce itself has a number of configurable options and allows for extensions of many different categories viz Payment Gateways, Shipping and more.
If you want to quickly customize them directly, simply edit the templates located in this directory:
Some other methods of woocommerce customization are listed below:
A. Create your own woocommerce page through “woocommerce_content()” function making a copy of page.php and renaming it to “woocommerce.php” by finding the WP Loop: Find the code where it starts with this: : …. then delete/replace that with …and that will make it a WooCommerce loop instead.
B. If you’re more technically inclines, you can also use hooks. Read the instructions here: Third party / custom / non-WC theme compatibility
Also, you may override existing pages:
The WooCommerce plugin comes with a number of front-end HTML templates as well as email templates. Instead of editing these files directly within the plugin (which is a very bad idea because once update the plugin and all of your changes will be lost!), you can copy them into your theme:
1. In your theme directory, make a new folder called “woocommerce.”
2. Navigate to the WooCommerce plugin directory and open the “templates” folder. The templates folder has a lot of subfolders with all of the different templates that WooCommerce uses. Fortunately, the template file structure and naming in WooCommerce is easy to follow.
3. In your newly created “woocommerce” folder, copy the template file that you want to edit. Remember to keep the directory structure the same here. If the template you want to edit is within a subfolder then remember to create that subfolder within your theme’s directory.
4. Edit the file from within your “woocommerce” folder and save the changes.