Allow sort products by "include" order

This commit is contained in:
Claudio Sanches 2019-08-01 15:55:32 -03:00
parent ad6d9ec8fe
commit decea3d28c
1 changed files with 5 additions and 0 deletions

View File

@ -1958,6 +1958,11 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
add_filter( 'posts_where', array( $this, 'reviews_allowed_query_where' ), 10, 2 ); add_filter( 'posts_where', array( $this, 'reviews_allowed_query_where' ), 10, 2 );
} }
// Handle orderby.
if ( isset( $query_vars['orderby'] ) && 'include' === $query_vars['orderby'] ) {
$wp_query_args['orderby'] = 'post__in';
}
return apply_filters( 'woocommerce_product_data_store_cpt_get_products_query', $wp_query_args, $query_vars, $this ); return apply_filters( 'woocommerce_product_data_store_cpt_get_products_query', $wp_query_args, $query_vars, $this );
} }