• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Override WooCommerce archive-product.php Template File In Genesis

Based on the following statement published on the official WooCommerce website, you can’t override the archive.product.php file in Genesis :

If your theme has a woocommerce.php file, you will be unable to override the woocommerce/archive-product.php custom template in your theme, as woocommerce.php has priority over other template files. This is intended to prevent display issues.

Previously :

If you want to customize the WooCommerce archive-product.php template, copy this file (keep same name) and place the copy in the child theme’s woocommerce folder, ie themes/my-child-theme/woocommerce (Your theme may not have a ‘woocommerce’ folder, in which case create one.) The version in the child theme’s woocommerce folder will override this template, and any future updates to this plugin won’t wipe out your customizations.

However, this method no longer works in Genesis child themes.

There’s at least 3 ways you could still use a custom woocommerce archive template in Genesis.

Solution 1 : Activate the Genesis Connect for WooCommerce plugin. This enables you to use a custom archive page template in your woocommerce folder within your child theme.

Solution 2 : Name the file taxonomy.php using the WordPress Template Hierarchy.

or

Solution 3 : Add the following PHP code to the end of your child themes functions file and use conditional tag to target specific archive page types.


add_filter( 'template_include', 'woocommerce_archive_template', 99 );

function woocommerce_archive_template( $template ) {

    if ( is_woocommerce() && is_archive() ) {
        $new_template = get_stylesheet_directory() . '/woocommerce/archive-product.php';
        if ( !empty( $new_template ) ) {
            return $new_template;
        }
    }

    return $template;
}

In this case we’ll override all the archive template in WooCommerce by loading a custom template named archive-product.php from a folder named woocommerce in the child themes root directory.

Make sure the file location matches the path used in the above code snippet and that you also use the correct conditional tags target the archive template you want to customize.

Related Templates

  • Custom WooCommerce Product Page Archive Template For Genesis

WooCommerce

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags