WooCommerce Template overriding not working with woocommerce.php

I am creating a custom theme with my own HTML. I am trying to override woocommerce template. I have created a template named with woocommerce.php but it still shows template with default structure.

I checked the system status and it says that Your theme has a woocommerce.php file, you will not be able to override the woocommerce/archive-product.php custom template since woocommerce.php has priority over archive-product.php. This is intended to prevent display issues.

But when I load the shop page it opens up with default structure.

Some screenshots

  1. Folder Structure
  2. WooCommerece system status
  3. woocommerece.php

Topic woocommerce-offtopic template-hierarchy Wordpress

Category Web


I fix that by disabling Woocommerce template debug mode in config.php.

define( 'WC_TEMPLATE_DEBUG_MODE', false );

You can check if the template debug mode is set via:

WP Dashboard -> WooCommerce -> System Status -> Tools


It's a custom theme, so first of all you should check if WooCommerce support is declared in the functions.php.

WooCommerce can be integrated with the theme by using woocommerce_content() (woocommerce.php file) or by template overrides, but in both cases the declaration of support in the theme is required.

function wpse319485_add_woocommerce_support() {
    add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'wpse319485_add_woocommerce_support' );

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.