2

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
9
  • chnage folder name woocommerce2 to woocommerce Commented Nov 17, 2018 at 7:20
  • copy this file to /themes/themexxxx/woocommerce folder: Commented Nov 17, 2018 at 7:20
  • I want to override from woocommerce.php instead of customizing whole template. Commented Nov 17, 2018 at 7:22
  • i think this not possible because this is main plugin file of woocommerce. Commented Nov 17, 2018 at 7:31
  • please see this link : theme.co/apex/forum/t/… Commented Nov 17, 2018 at 7:37

2 Answers 2

8

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' );
1
  • Thanks it worked for me.
    – Arman H
    Commented Dec 6, 2020 at 12:06
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.