Skip Navigation

[Resolved] Toolset Views not showing "_featured" in view GUI for woocommerce

This support ticket is created 6 years, 11 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.

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
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 2 replies, has 2 voices.

Last updated by Christian Cox 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#520346
Screen Shot 2017-05-04 at 12.34.13 PM.png

I am trying to: create view loop for featured items in toolset. I have marked a couple of woocommerce products as featured, and went to toolset > settings > front-end content > select custom fields (From hidden custom fields) and the "_featured" field is not showing. I have run this on another site i built, and it was there, i noticed that the other site wasn't running the most current version ,so i updated it to match, and it still showed. I also on the current site i'm building deactivated and deleted both woocommerce and every thing from toolset i had installed, but it did not fix the problem.

#520389

Interesting, if I start from scratch using WooCommerce 3.0.5, then create a featured product, the _featured field is not available in the hidden fields dialog.

However if I start from scratch using WooCommerce 2.6.14, create a featured product, the field is available. If I then update to WC 3.0.5, the _featured field remains available. Let me reach out to our 2nd tier supporters for some assistance here. I'm not sure if this is a bug, or something that WooCommerce has purposefully hidden. I'll update you as soon as I receive some information from them, please standby.

#521261

It appears that WooCommerce has moved the "featured" product setting around a bit since 3.0. Before, the featured setting was maintained in a custom field related to products. Now, this setting has been moved into a hidden product taxonomy called "product_visibility". As such, Views is unable to access that hidden taxonomy in order to be able to filter on it. So any products that were set as "_featured" before 3.0 can be filtered using the custom field that already existed. However, any products set as featured since 3.0 cannot currently be filtered by Views without some custom code.

I've passed this information along to our developers, who will likely decide to add a fix for this in a future version of WooCommerce Views.

In the meantime, I may be able to provide you some code that will apply this new taxonomy term in a filter on the back-end without adding it through the front-end Views filter GUI. Try adding the following code to functions.php:

add_filter( 'wpv_filter_query', 'featured_products',99,3 );
function featured_products( $query_args,$views_settings, $view_id) {

if ($view_id == 10){
$query_args = array(
  'post_type'  => 'product',
  'tax_query' => array(
    array(
      'taxonomy'     => 'product_visibility',
      'field'   => 'name',
      'terms' => 'featured',
      'operator' => 'IN'
    ),
  ),
);
}
    return $query_args;
}

Please replace "10" with the ID of the View where you want to display featured products. Let me know the results and we can go from there.

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