Merge pull request #21408 from woocommerce/fix/21269

Dont modify attributes orderby when ordering by name
This commit is contained in:
Gerhard Potgieter 2018-09-26 13:30:40 +02:00 committed by GitHub
commit a365fb10e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -480,6 +480,12 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) {
foreach ( (array) $taxonomies as $taxonomy ) {
if ( taxonomy_is_product_attribute( $taxonomy ) || in_array( $taxonomy, apply_filters( 'woocommerce_sortable_taxonomies', array( 'product_cat' ) ), true ) ) {
// Don't modify the orderby when we're ordering attributes by name.
if ( taxonomy_is_product_attribute( $taxonomy ) && 'name' === wc_attribute_orderby( $taxonomy ) ) {
return $clauses;
}
$found = true;
break;
}