How to override WooCommerce default template file?

WooCommerce provides default templates for frontend and HTML emails of the store. If we want to modify those default templates we can very easily override a template.

When we open these files, we will notice they all contain hooks that allow you to add/move content without needing to edit template files themselves. These hooks protect against WooCommerce upgrade issues, as the template files can be left completely untouched. If we do change those templates inside the plugin, then the next WooCommerce update will wipe those changes.

Template files can be found within the plugins/woocommerce/templates/** directory.

Change WooCommerce templates

We need to copy WooCommerce templates into a directory within our 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/ourtheme/woocommerce/emails/admin-new-order.php

If we keep the above file structure then admin-new-order.php will override the plugins admin-new-order.php.

Share