Merge pull request #21408 from woocommerce/fix/21269
Dont modify attributes orderby when ordering by name
This commit is contained in:
commit
a365fb10e9
|
@ -480,6 +480,12 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) {
|
||||||
|
|
||||||
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' ) ), true ) ) {
|
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;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue