I tried implementing this code that was posted a few months back, and it did what it was supposed to do. The only problem is that I have another archive page that automatically adds all products on sale to an Outlet page. Is there a way to exclude the outlet archive page from this code?
// Display featured products in shop pages
add_filter('woocommerce_product_query_tax_query','custom_product_query_tax_query', 10, 2 );
function custom_product_query_tax_query( $tax_query, $query ) {
if( is_admin() ) return $tax_query;
if ( is_shop() ) {
$tax_query[] = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured'
);
}
return $tax_query;
}