Move meta query init above sku query

This commit is contained in:
claudiulodro 2017-07-14 10:10:37 -07:00
parent 96bc5e6f95
commit 8c8684b8aa
1 changed files with 7 additions and 7 deletions

View File

@ -1291,6 +1291,13 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$wp_query_args = parent::get_wp_query_args( $query_vars );
if ( ! isset( $wp_query_args['date_query'] ) ) {
$wp_query_args['date_query'] = array();
}
if ( ! isset( $wp_query_args['meta_query'] ) ) {
$wp_query_args['meta_query'] = array();
}
// Add the special SKU query if needed.
if ( $sku_query ) {
$wp_query_args['meta_query'][] = array(
@ -1300,13 +1307,6 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
);
}
if ( ! isset( $wp_query_args['date_query'] ) ) {
$wp_query_args['date_query'] = array();
}
if ( ! isset( $wp_query_args['meta_query'] ) ) {
$wp_query_args['meta_query'] = array();
}
// Handle product types.
if ( 'variation' === $query_vars['type'] ) {
$wp_query_args['post_type'] = 'product_variation';