Skip to content

Overriding Woocommerce templates via a theme

Fazle Bari edited this page Dec 30, 2020 · 1 revision

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

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 files can be found within the /woocommerce/templates/directory

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 archive page, copy: wp-content/themes/yourtheme/woocommerce/archive-product.php

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

Now edit archive-product.php and delete woocommerce_shop_loop and paste our table shortcode

Example – echo do_shortcode(“[Product_Table id=’104′ name=’test’]”);

Clone this wiki locally