Add tm.meta_value to the DISTINCT list since it is being used in the ORDER BY clause.

This commit is contained in:
Justin Shreve 2017-01-03 10:43:48 -08:00
parent 2572df6140
commit 3513f50e55
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 ) {