Show only products with rating (https://github.com/woocommerce/woocommerce-blocks/pull/10434)
This commit is contained in:
parent
62268b7017
commit
76e68dddfd
|
@ -14,11 +14,17 @@ class ProductTopRated extends AbstractProductGrid {
|
|||
protected $block_name = 'product-top-rated';
|
||||
|
||||
/**
|
||||
* Force orderby to rating.
|
||||
* Show only products with ratings and order by rating.
|
||||
*
|
||||
* @param array $query_args Query args.
|
||||
*/
|
||||
protected function set_block_query_args( &$query_args ) {
|
||||
$query_args['orderby'] = 'rating';
|
||||
|
||||
$this->meta_query[] = array(
|
||||
'key' => '_wc_average_rating',
|
||||
'value' => 0,
|
||||
'compare' => '>',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue