Merge pull request #12744 from woocommerce/fix/distinct-12689
Update wc_terms_clauses query
This commit is contained in:
commit
13018752ea
|
@ -483,7 +483,7 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) {
|
||||||
return $clauses;
|
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;
|
$found = false;
|
||||||
foreach ( (array) $taxonomies as $taxonomy ) {
|
foreach ( (array) $taxonomies as $taxonomy ) {
|
||||||
if ( taxonomy_is_product_attribute( $taxonomy ) || in_array( $taxonomy, apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ) ) ) {
|
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.
|
// Query fields.
|
||||||
$clauses['fields'] = 'DISTINCT ' . $clauses['fields'];
|
$clauses['fields'] = 'DISTINCT ' . $clauses['fields'] . ', tm.meta_value';
|
||||||
|
|
||||||
// Query join.
|
// Query join.
|
||||||
if ( get_option( 'db_version' ) < 34370 ) {
|
if ( get_option( 'db_version' ) < 34370 ) {
|
||||||
|
|
Loading…
Reference in New Issue