woocommerce/docs/theme-development/template-structure.md

10 KiB

post_title
Template structure & Overriding templates via a theme

Note: this document is geared toward template development for classic themes. For the recommended modern approach, visit Develop Your First Low-Code Block Theme to learn about block theme development, and explore the Create Block Theme plugin tool when you're ready to create a new theme.
We are unable to provide support for customizations under our Support Policy. If you need to further customize a snippet, or extend its functionality, we highly recommend Codeable, or a Certified WooExpert.


Overview


WooCommerce template files contain the markup and template structure for frontend and HTML emails of your store.

Documentation for Template structure & Overriding templates via a theme

When you open these files, you will notice they all contain hooks that allow you to add/move content without needing to edit template files themselves. This method protects against upgrade issues, as the template files can be left completely untouched.

Template List


Template files can be found within the /woocommerce/templates/ directory:

Latest version Files
v8.4.0 View template files

Expand to view files of all major previous versions
Version Files
v8.3.0 View template files
v8.2.0 View template files
v.8.1.0 View template files
v8.0.0 View template files
v7.9.0 View template files
v7.8.0 View template files
v7.7.0 View template files
v7.6.0 View template files
v7.5.0 View template files
v7.4.0 View template files
v7.3.0 View template files
v7.2.0 View template files
v7.1.0 View template files
v7.0.0 View template files
v6.9.0 View template files
v6.8.0 View template files
v6.7.0 View template files
v6.6.0 View template files
v6.5.0 View template files
v6.4.0 View template files
v6.3.0 View template files
v6.2.0 View template files
v6.1.0 View template files
v6.0.0 View template files
v5.9.0 View template files
v5.8.0 View template files
v5.7.0 View template files
v5.6.0 View template files
v5.5.0 View template files
v5.4.0 View template files
v5.3.0 View template files
v5.2.0 View template files
v5.1.0 View template files
v5.0.0 View template files
v4.9.0 View template files
v4.8.0 View template files
v4.7.0 View template files
v4.6.0 View template files
v4.5.0 View template files
v4.4.0 View template files
v4.3.0 View template files
v4.2.0 View template files
v4.1.0 View template files
v4.0.0 View template files
v3.9.0 View template files
v3.8.0 View template files
v3.7.0 View template files
v3.6.0 View template files
v3.5.0 View template files
v3.4.0 View template files
v3.3.0 View template files
v3.2.0 View template files
v3.1.0 View template files
v3.0.0 View template files
v2.6.0 View template files

How to Edit Files


Edit files in an upgrade-safe way using overrides. Copy the template into a directory within your theme named /woocommerce keeping the same file structure but removing the /templates/ subdirectory.

Example: To override the admin order notification, copy: wp-content/plugins/woocommerce/templates/emails/admin-new-order.php to wp-content/themes/yourtheme/woocommerce/emails/admin-new-order.php.

The copied file will now override the WooCommerce default template file.

Warning: Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customizations will be lost. For more detailed information, see Fixing Outdated WooCommerce Templates.

For Custom Templates

If you are a theme developer or using a theme with custom templates, you must declare WooCommerce theme support using the add_theme_support function. See Declaring WooCommerce Support in Themes at GitHub.

If your theme has a woocommerce.php file, you will be unable to override the woocommerce/archive-product.php custom template in your theme, as woocommerce.php has priority over other template files. This is intended to prevent display issues.


Need support with editing your Woo store? WooExpert agencies are here to help. They are trusted agencies with a proven track record of building highly customized, scalable online stores. Hire an Expert.