While working on a support ticket for a client I came across the fact that the Soliloquy slider plugin for WordPress has not updated their WooCommerce addon (since WooCommerce 3.0+ changed how they store the featured products variable in the database). It went from metadata in the wp_postmeta table to a Product Visibility taxonomy.

Hopefully it will be resolved in future releases of the Soliloquy plugin.

Comment Out Line 328 to Line 357:

if ( ! empty( $terms ) ) {
// Set our taxonomy relation parameter
$relation['relation'] = 'AND';

// Loop through each term and parse out the data.
foreach ( $terms as $term ) {
$term_data = explode( '|', $term );
$taxonomies[] = $term_data[0];
$terms[] = $term_data;
}

// Loop through each taxonony and build out the taxonomy query.
foreach ( array_unique( $taxonomies ) as $tax ) {
$tax_terms = array();
foreach ( $terms as $term ) {
if ( $tax == $term[0] ) {
$tax_terms[] = $term[2];
}
}

$relation[] = array(
'taxonomy' => $tax,
'field' => 'slug',
'terms' => $tax_terms,
'operator' => $operator,
'include_children' => false,
);
}
$query_args['tax_query'] = $relation;
},

Replace: (line 402)

if ( $instance->get_config( 'wc_featured_products', $data ) ) {

$meta[] = array(
'key' => '_featured',
'value' => 'yes'
);

}

With:

if ( $instance->get_config( 'wc_featured_products', $data ) ) {
$relation2['relation'] = 'AND';
$relation2[] = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
);
$query_args['tax_query'] = $relation2;

}

This update however removes the ability to sort by taxonomy, so you cannot have a slider that is featured products of a specific taxonomy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.