How to Override WooCommerce Templates via a WordPress Theme

It is normal that one needs to modify a WooCommerce shop’s templates. It is not recommended to change the files in WooCommerce (WC) plugin directory. Fortunately, WC provides us with a way to override template files via a theme.

WC template files contain the markup and template structure for frontend and HTML emails of a store. These files contain hooks that allow you to add/move content without needing to edit template files themselves. Besides, we can modify the files directly after copying those files to the theme folder.

Under wp-content\plugins\woocommerce\templates, you will find all template files that the plugin use.

Copy the whole templates folder and copy it to your theme as a WooCommerce folder. So woocommerce\templates will become your-theme\woocommerce.

That’s to override all files, but if you only need to modify a certain template, just copy only that file. But you still need to keep the folder structure.

The template for the shop page is archive-product.php. To override the shop page, copy: wp-content/plugins/woocommerce/templates/archive-product.php to wp-content/themes/yourtheme/woocommerce/archive-product.php.

If your theme doesn’t support WooCommerce yet, trigger the support with the following lines in functions.php.

function yourtheme_add_woocommerce_support() {
    add_theme_support( 'woocommerce' );
add_action( 'after_setup_theme', 'yourtheme_add_woocommerce_support' );

Leave a Comment

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

Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.