Docly

Overriding Woocommerce templates via a theme

Estimated reading: 1 minute 164 views

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 the 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']");

CONTENTS