I’m trying to customize the standard woocommerce theme and so far that has worked well. I copied all template files from /plugins/woocommerce/templates
to /mytheme/woocommerce
and customized the files.
But when i’m change something in archive-product.php
nothing happens? I even tried to customize this in the core files (/plugins/woocommerce/templates/archive-product.php
) but i doesn’t work.
I want to change the class of the h1
heading: <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
.
So i looked up all woocommerce template files, the class page-title
occurs only in this one file (to prevent editing the wrong file).
Edit:
In detail, i want to customize the theme used in this path: http://example.com/product-category/mycategory
I tried all the above solutions, to no avail. No matter what I did, the archive-product.php was not being used at all. Instead, most woocommerce pages were using page.php from my theme.
The solution for me was to add theme support… Which, it’s been a while since I used woocommerce, so I completely forgot about that. But after adding the following line to my functions.php file, archive-product.php is now being used (/mytheme/woocommerce/archive-product.php) and I can update it, as I should be able to.
Seems this is STILL an issue in Woocommerce. For anyone landing here, the following solution was working for me as of version 2.1.6.
Apparently the problem is due to the function woocommerce_content() outputting the wrong page for archive content.
I used the following to get around it:
replace woocommerce_content() in woocommerce.php with:
Credit: found the solution here
Here’s how I fixed mine:
If you use the woocommerce.php method you cannot customize archive-product. You must use the hooks method
For others searching here, doublecheck the path. It is for example not
/mytheme/woocommerce/templates/archive-product.php
but only/mytheme/woocommerce/archive-product.php
. I didn’t have to apply @Talk nerdy to me’s patch or any other to make it work.you need to edit the file “taxonomy-product_cat.php” and add a conditional is_product_category( ‘mycategory’ ).
wc_get_template( 'archive-product.php' );
with: