I am building a website from scratch on WordPress using WooCommerce. I'll be having products from numerous brands and to have an easier time organizing them, I've made each brand a category. Currently, when I go to mywebsite.com/product-category/brand_name it's using my page.php template. I would like it to use a different one, but I'm not sure what file I need to add. I tried page-product-category.php, page-product.php, page-category.php and nothing seems to work. I understand that "woocommerce/content-product.php" is what I need to edit in order t ochange what the woocommerce output looks like, but I also need to edit everything else, header, navigation, footer and so on. I tried a few more different pages too, such as "woocommerce/woocomerce.php", "category.php", but still no luck, it still uses my page.php template. Thank you in advance!
1 Answer
product-category
URL uses taxonomy-product-cat.php
which calls archive-product.php
you will need to override it by creating the same file with the same name in themefolder/woocommerce/archive-product.php
You can open any file in templates folder in the WooCommerce plugin and you will find a line in the very top comment describes how to override the file.
Don't forget to add add_theme_support( 'woocommerce' );
in the theme functions.php
If It's not there.
-
Thank you so much for offering to help! So I took my page.php and duplicated it, renamed it to taxonomy-product-cat.php and then changed something in it so I can tell the difference and I uploaded it in my theme folder. I then refreshed the /product-category/ page and it's still picking up the page.php file :( What am I missing? Sep 5, 2018 at 16:16
-
Ok I figured it out. I also needed add_theme_support( 'woocommerce' ); in my functions.php file. Could you please edit your answer by adding that so I can mark it as the full correct answer? Thanks! Sep 5, 2018 at 16:28
-
-
Yeah, I didn't know, my first time using WooCommerce :p. Thanks for your help! Sep 5, 2018 at 17:08
-