Search

Template Structure + overriding templates via a theme

The template files of WooCommerce contain the markup and template structure for the front-end (and HTML emails) of your store. If you open these files you’ll notice they all contain many hooks which will allow you to add / move content without having to edit the template files themselves. This method protects even further against any upgrade issues as the template files can be left completely untouched.

Alternatively, you can edit these files in an upgrade safe way through overrides. Simply copy it into a directory within your theme named /woocommerce, keeping the same file structure.

Example: To overide the admin order notification, copy: woocommerce/templates/emails/admin-new-order.php to yourtheme/woocommerce/emails/admin-new-order.php

The copied file will now override the WooCommerce default template file. Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customisations will be lost.

The  template files can be found within the /woocommerce/templates/ directory:

Version Files
v2.1.0 View template files
v2.0.20 View template files
v1.6.6 View template files

These files contain the markup and template structure for the front-end (and HTML emails) of your store. If you want to edit one of these templates simply copy it into a directory within your theme named /woocommerce, keeping the same file structure, e.g. move /templates/cart/cart.php to themename/woocommerce/cart/cart.php. The copied file will now override the WooCommerce default template file. Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customisations will be lost.

If you open these files you’ll notice they all contain many hooks which will allow you to add / move content without having to edit the template files themselves. This method protects even further against any upgrade issues as the template files can be left completely untouched.

If you are looking for an explanation of what the template files do, check out our WooCommerce API documentation page.
Please note: when creating woocommerce.php in your theme’s folder, you won’t be able to override the woocommerce/archive-product.php custom template as woocommerce.php has the priority over archive-product.php. This is intended to prevent display issues.
Back to the top