Skip Navigation

[Resolved] filtering woo archive by product category

This thread is resolved. Here is a description of the problem and solution.

Problem:
The customer wants to have a different WooCommerce product archive template for each of their two categories. However, when attempting to add a filter to apply it to a category, they receive an error indicating that the filter cannot be applied.

Solution:
Taxonomy term filters are not supported on taxonomy archives, and the error received is expected behavior. For example, if on a taxonomy WordPress archive page (e.g., "my-tax"), the filter will not work on that page and will display a warning message.
As a workaround, the customer can create a view to display term archive page links:

Create a taxonomy view that lists terms of the custom taxonomy.
Display the term's archive page link with the shortcode [wpv-taxonomy-link].
Insert this taxonomy view into the taxonomy WordPress archive.
This allows users to click the links and be redirected to the corresponding term's archive page.

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mateus Getulio 7 months, 2 weeks ago.

Assisted by: Mateus Getulio.

Author
Posts
#2701441
screenshot-nstem.org-2024.06.06-12_41_24.png

Hi im wanting to have a different woo product archive template for each of my 2 categories however when i try and add a filter to apply it to a category i get an error telling me the filter cant be applied. Should this work

See attached image

#2701471

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

I'm afraid that taxonomy term filter is not supported on taxonomy archives and the results you get is expected.

When it is a taxonomy wordpress archive, for example "my-tax", the taxonomy filer won't be able to work, you should be able to see the warning message in the screenshot you shared:
This filter will not be applied to Taxonomy Archives matching the filtered taxonomies: my-tax

This is expected result, for example, you are in the term "term1" archive page:
hidden link
It should not display the other term's posts
So the taxonomy filter won't be able to work in the taxonomy archive page.

As a workaround, I suggest you try create a view display the term archive page links, for example:
Create a taxonomy view, list terms of the custom taxonomy, display the term's archive page link with shortcode [wpv-taxonomy-link]:
https://toolset.com/documentation/views-shortcodes/#wpv-taxonomy-link

Put the above taxonomy view into the taxonomy wordpress archive, users click those links, they will be redirected to corresponding term's archive page.

#2701651

Ah got it thanks for the thorough explanation and solution