How to override WooCommerce template files?

The WooCommerce template files are different from the WordPress Template files look at this to see how it works and the template file for shop pages is archive-product.php

Usually, all themes provide a separate sidebar area for the shop page, did you check if your theme is compatible with WooCommerce?
If yes then you should have a sidebar available under Appearance->Widgets with name similar to ‘Shop Sidebar’

How to override a template?

To override the shop page,

copy: wp-content/plugins/woocommerce/templates/archive-product.php
to wp-content/themes/your_theme_name/woocommerce/archive-product.php

and then make the necessary changes to the template in your themes folder.

What happens is WooCommerce checks for the archive-product.php file in theme directory first and if it finds a file in woocommerce/ directory then it will use that file instead of the default one.
So now you have to edit the file inside your_theme_folder/woocommerce to make any changes.

Leave a Comment