Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding template via the theme does not work in Woocommerce

I'm creating a custom Wordpress/woocommerce theme for a client based on FoundationPress. For some reason I can't override taxonomy-product_cat.php. I can override this file with other themes like twenty-nnn or Storefront. I spend half a day finding a answer with no luck.

At the end I stripped down the Foundationpress theme to just a index.php + style.css. I cleared the caches, recreated the template files in Woocommerce > status > tools. I disabled all the third party plugins except Woocommerce.

But it still refuses to override my category template. I'm stuck here. Can somebody please give me some directions?

In 'Woocommerce > status' I see this template marked as overridden. But It doesn't show on the frontend.

like image 944
Norman van der Mull Avatar asked Sep 16 '25 03:09

Norman van der Mull


1 Answers

Solved:

I finally found a solution.

You have to declare "add_theme_support" in your functions.php:

add_theme_support( 'woocommerce' ); 

After that, my custom Woocommerce templates finally gets recognized.

Strangely enough it's not mentioned clearly in the docs on the Woocommerce website.

like image 168
Norman van der Mull Avatar answered Sep 17 '25 19:09

Norman van der Mull