Heads up! This article may contain PHP codes and is intended for the Developers. However, feel free to learn!

Templates in WordPress are the files that provide the layout on how the contents are displayed on the site. Any templates in WordPress can be customized on your own. The templates provided by the plugins such as WooCommerce can be customized and overridden without affecting the original template and without affecting the update of the plugins/themes. Generally, it is named “templates” because of these characteristics.

Templates in WooCommerce

All the template files in WooCommerce can be found in the templates directory inside the root directory. This means all these templates can be customized and overridden.

WooCommerce Template Files

If you open the template file, you can see the description on the file header. Example:

 * The Template for displaying product archives, including the main shop page which is a post type archive
 * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.

Customizing And Overriding Templates

So, every template file inside the templates directory can be customized and overridden. Let’s take the example of Admin New Order Email.

The steps to customize and override the admin new order email are:

1) Go to wp-content/plugins/woocommerce/templates/emails.

2) Copy the file admin-new-order.php.

3) Go to wp-content/themes/your-theme/ (Creating a child theme is preferred.)

4) Create a folder “woocommerce” and then “emails” inside woocommerce.

5) So that the folder structure would be wp-content/themes/your-theme/woocommerce/emails

6) Paste the copied template file here. So, the file would be wp-content/themes/your-theme/woocommerce/emails/admin-new-order.php

7) Customize the admin-new-order.php file the way you like it.

That’s all. The template file from the theme will override the template file in the plugin.

Did you know? You can find all the steps of your customers by using Customer Journey For WooCommerce plugin

WooCommerce Template Overriding And Customizing
Tagged on:     

Sanjeev Aryal

Don't bury your thoughts, put your vision into reality ~ Bob Marley.

Leave a Reply

Your email address will not be published. Required fields are marked *