From 8c8684b8aa4b8e48f20d42ecd667c837252295f4 Mon Sep 17 00:00:00 2001 From: claudiulodro Date: Fri, 14 Jul 2017 10:10:37 -0700 Subject: [PATCH] Move meta query init above sku query --- .../class-wc-product-data-store-cpt.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 0513566a35b..872e7c2614f 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -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';