Skip Navigation

[Résolu] WooCommerce Featured Flag in Views Filter

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
How to add a Views filter for the built-in WooCommerce "featured" product feature.

Solution:
WooCommerce stores this as a taxonomy term, namely the "Product Visibilty" taxonomy which can be included as a filter in Views.

This support ticket is created Il y a 5 années et 7 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Marqué : ,

This topic contains 3 réponses, has 2 voix.

Last updated by Tim Elliott Il y a 5 années et 7 mois.

Assisted by: Nigel.

Auteur
Publications
#1110150

Tell us what you are trying to do?
I'm trying to use the inbuilt Woocommerce "Featured Product" flag in a Views filter. This is the one that shows stars on the product listing page.

Is there any documentation that you are following?
https://toolset.com/forums/topic/featured-flag-in-woocommerceviews/
This thread gives instructions on how to add _featured to the views filter, but the thread is from 5 years ago so maybe things have changed since.
I've selected a number of items as Featured on the product listing page.
I've been to Settings > Front End Content >> Hidden Custom Fields and clicked on "Select custom fields". However _featured is not in the list of fields, nor is any other field that looks like it might be the one.

I also tried this on another Woocommerce site just to check if it was something site-specific. It was the same there.

Is there a similar example that we can see?
N/A

What is the link to your site?
hidden link

#1110570

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Hi Tim

I just checked on a local test site and I marked a product as featured (by clicking the star on the product listing page in the backend).

I then went to the wp_postmeta table of the database and checked the custom fields for that product post.

There is no such field as _featured.

I guess WooCommerce have changed how/where they store this data.

If it is stored in a custom table then it wouldn't be amenable to using in a Views filter, but I would first try to establish where WC now store this data.

(I would look myself but the queue is currently very loaded and I'm trying to help as many clients as possible.)

If you find out let me know.

#1110606

OK I see what you mean. Right, Woocommerce now stores "Featured" as a Taxonomy. I have found it in my 'terms' table, and found the relationships between that taxonomy and the products in the 'term_relationships' table.

For some reason it's not shown on the Dashboard for taxonomies for products. Nor does it appear in the taxonomy filter selection. I don't know what criteria Views uses to pick which to display but my guess it that WC sets the taxonomy up in a very basic way so views doesn't find some of the info it would need.

I know it's low priority so don't spend time on it unless you clear all the important stuff 🙂

#1110607

Right, found it. It is actually a term under the "Product Visibilty" taxonomy, which is available to views.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.