How To Modify Archive Templates in WooCommerce

If you want to modify the default product archive page template for a specific taxonomy or term like category, you can use code to load a custom template conditionally in 3 steps :

Step 1 : Copy and paste this PHP code from the view raw link to the end of your child themes functions file or custom functions/code snippets plugin.

Step 2 : Copy over your WooCommerce archive-product.php template to your child themes and rename it to match the filename in the code. In this case, custom-archive.php.

Step 3 : In the code, set your conditional tag so your new custom-archive.php template only loads on the taxonomy archives you want, in this case, the shoes category archive page on this line :

if ( is_product_category('shoes') ) {

For use on multiple archives, add an array to the conditional tag like this :

if ( is_product_category(array('shoes', 'electronics') ) ) {

This will load the custom-archive.php template on both category archive pages.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.