Merge pull request #12744 from woocommerce/fix/distinct-12689

Update wc_terms_clauses query
This commit is contained in:
Mike Jolley 2017-01-04 10:47:49 +00:00 committed by GitHub
commit 13018752ea
1 changed files with 2 additions and 2 deletions

View File

@ -483,7 +483,7 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) {
return $clauses;
}
// Wordpress should give us the taxonomies asked when calling the get_terms function. Only apply to categories and pa_ attributes.
// WordPress should give us the taxonomies asked when calling the get_terms function. Only apply to categories and pa_ attributes.
$found = false;
foreach ( (array) $taxonomies as $taxonomy ) {
if ( taxonomy_is_product_attribute( $taxonomy ) || in_array( $taxonomy, apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) {
@ -503,7 +503,7 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) {
}
// Query fields.
$clauses['fields'] = 'DISTINCT ' . $clauses['fields'];
$clauses['fields'] = 'DISTINCT ' . $clauses['fields'] . ', tm.meta_value';
// Query join.
if ( get_option( 'db_version' ) < 34370 ) {