Overriding WooCommerce archive-product.php

Date Posted: February 18, 2015, 10:18 am


Recently I was working on a WooCommerce project and was having problems customizing the Products Page, I can’t seem to override the archive-product.php. Later I found out that the problem is due to the function woocommerce_content() outputting the wrong page for archive content.

To get around it, replace

1
<?php woocommerce_content() ?>

in woocommerce.php with:

1
2
3
4
5
<?php if ( is_singular( 'product' ) ): ?>
    <?php woocommerce_content(); ?>
<?php else: ?>
    <?php woocommerce_get_template( 'archive-product.php' ); ?>
<?php endif; ?>

About author


Carl Victor Fontanos

A fine gentleman specializing in front-end and back-end development with extensive experience building high performance web applications that keeps users engaged and help businesses grow.

 
Hire Me