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

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

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

define( 'WC_TEMPLATE_DEBUG_MODE', false );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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