Skip Navigation

[Resolved] Creating Custom Woocommerce Taxonomy Archive using PHP

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by jamesL-9 7 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#581346

Hi,

I have created several Custom Taxonomies for Woocommerce Product. An example of the Taxonomy I have created is "coffee_region" with an example Term "ethiopia"

Out of the box, I am able to display the Term Archive page which uses Woocommerce archive-product.php template. It basically listed out all my products with the Term "ethiopia"

For a clearer idea of my objectives, I will list them below:

1) Create a Taxonomy Archive page - ie for the Taxonomy "coffee_region" which lists out all the Terms

2) Customize the 'coffee_region' Taxonomy and Term Archive pages separately from the other Archive pages.
- I will post this as a separate ticket later after we have resolved objective 1

I am using PHP instead of Layout/Wordpress Archive to achieve this because I only want to add minor changes to the templates rather than starting up from scratch.

For objective 1, I have been referring to https://toolset.com/documentation/customizing-sites-using-php/creating-taxonomy-term-archives/.
As I want my archive pages to look like woocommerce archive, I have used archive-product.php as my starting point.

This is what I have done so far:
1) Copy archive-product.php to the folder mychildtheme/woocommerce
2) Rename to taxonomy-coffee-region.php

However, this has not been giving me the result I hoped for. The mysite.com/coffee-region only returned the 404 error. Am I missing something here? I have tried moving the php file to mychildtheme main folder but it was negative as well.

Thank you in advance

#581439

Dear James,

It is expected result, you will see same 404 error in wordpress built-in taxonomy "category", for example URL:
hidden link

In your case, I suggest you try these:
1) Create a view, query terms of taxonomy "coffee_region"
and display the term's archive page

2) Create a wordpress page, for example, "coffee_region page",
display above view

Use the wordpress page of step 2) as the "Taxonomy Archive page" you mentioned above

#581821

Thanks Luo Yang for the suggestion.
I guess it is much simpler to compile a view of Terms on a Page.

Cheers,
James