Skip Navigation

[Resolved] Filter taxonomy items based on current product

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

Problem: I have a View of taxonomy terms displayed on a Product post. I would like to filter the View to show only terms associated with the current Product.

Solution: In the View's Query Filter section, you can add a Term filter set by the page where this View is displayed.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

This support ticket is created 5 years, 10 months 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by jelle-jacobd 5 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1189966
Schermafdruk 2019-01-23 20.30.22.png

Hi. I have a question about filtering a taxonomy loop on a product page. I have added an extra taxonomy called icons to the content type products (WooCommerce) with Toolset types. I have added 15 items / categories to which a product can be linked. In my case a product can fall into the taxonomy meat, fish or vegetables (see example page or image). Each item has an image which I would like to show on the product page, but only the selection of icons for this specific product. Now it is showing all the available values.

F.e.: hidden link or view the image.

The selection of icons shown are based on all entries (taxonomy items) en not just for this specific product, which I would like. How should I create a filter in views which makes this possible? is there a tutorial available with a similar approach?

Thanks.

#1189989

Hi, it should be possible in a View of your custom taxonomy to add a Query Filter. If you cannot see the Query Filter section, scroll to the top right corner of the View editor screen and click "Screen Options". You can activate the Query Filter section here. Then add a Taxonomy term Query Filter, where the term is "Set by the page where this View is inserted". This should produce a list of terms associated with the current post. If that's not working for you, I'll be glad to take a closer look.

#1190338

My issue is resolved now. Thank you!

#1190343

Hi Christian,

Is it possible to reorder the output manually, or do I need a third-party plugin like Simple Custom Post Order for it? The standard sort order options do not apply as my client prefers there own order of items.

#1190476

There's no drag-and-drop term ordering mechanism in Views/Types, but you can add a numeric custom term field to this taxonomy and sort based on that custom field.

#1190503

Thanks, I will try and do that. My issue is resolved now. Thank you!