Filter product by attribute, can’t order items
-
Hello, I am using your integrated Filter products by attribute, in list mode. This one: https://prnt.sc/uapib5
I need to order list items by count of items inside. So I am using it to filter clothes sizes:
S (1)
M (9)
L (11)
XL (8)
When I save the widget, I get something like this: https://prnt.sc/uapj5n
I need to order items, that the biggest count will be at the top.I tried to look at the woocommerce/includes/widgets/class-wc-layered-nav.php and found something like
$terms = get_terms($taxonomy, array('hide_empty'=>1));
I have edited this to
$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => '1' ) );
When I dump the $terms everywhere in code, I am getting the correct order. However, when the content is rendered on site, it is chaotic.
I think, there is any filter, or something like that, which reorder the items before rendering on site. How can I do it, that the biggest count item will be the first always?The page I need help with: [log in to see the link]
- The topic ‘Filter product by attribute, can’t order items’ is closed to new replies.