parent
e7acb2918c
commit
3fe7df6515
|
@ -384,12 +384,16 @@ class WC_Query {
|
|||
*/
|
||||
public function product_query( $q ) {
|
||||
// Ordering query vars
|
||||
if ( ! $q->is_search() ) {
|
||||
$ordering = $this->get_catalog_ordering_args();
|
||||
$q->set( 'orderby', $ordering['orderby'] );
|
||||
$q->set( 'order', $ordering['order'] );
|
||||
if ( isset( $ordering['meta_key'] ) ) {
|
||||
$q->set( 'meta_key', $ordering['meta_key'] );
|
||||
}
|
||||
} else {
|
||||
$q->set( 'orderby', 'relevance' );
|
||||
}
|
||||
|
||||
// Query vars that affect posts shown
|
||||
$q->set( 'meta_query', $this->get_meta_query( $q->get( 'meta_query' ), true ) );
|
||||
|
|
|
@ -787,7 +787,7 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
|||
function woocommerce_catalog_ordering() {
|
||||
global $wp_query;
|
||||
|
||||
if ( 1 === (int) $wp_query->found_posts || ! woocommerce_products_will_display() ) {
|
||||
if ( 1 === (int) $wp_query->found_posts || ! woocommerce_products_will_display() || $wp_query->is_search() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue