Viewing 4 replies - 1 through 4 (of 4 total)
  • Try to remove line 207 from woocommerce-collapsing-categories.php

    'orderby' => $qp_orderby,

    That did the trick for me!

    For anyone who doesn’t want to modify the plugin source code, and just wants to use built in functionality, if you change the Category orderby setting under https://example.com/wp-admin/options-general.php?page=woocommerce-collapsing-categories to simply be ‘name’ then it works properly.

    The explanation from my research, and why fakeartist’s solution works:

    In “/wp-content/plugins/woocommerce/includes/wc-term-functions.php” there is a function called ‘wc_terms_clauses’ that sets up all of the parameters for sorting whenever terms are retrieved. It does that through the filter ‘terms_clauses’ as seen below:
    add_filter( 'terms_clauses', 'wc_terms_clauses', 10, 3 );
    It is built such that it only will do any special sorting if you are retrieving the terms in their default order which is ‘name’. Now WooCommerce Collapsing Categories uses the function ‘wp_list_categories’ to grab the categories. In the course of events this calls the ‘terms_clause’ filter and WooCommerce sorts the terms if the orderby clause is set to ‘name’. But line 208, as mentioned by fakeartist overrules the default order of ‘name’ and uses whatever you have specified in the backend. So if in the settings panel you have set the value of ‘orderby’ to anything other than ‘name’ WooCommerce’s sorting will not be applied.

    I hope that helps someone else out.

    -Daniel

    Cheers @fakeartist !

    That also did the trick for me. Good stuff as the support on this plugin seems to be not-existing ??

    /Tim

    Excellent @d2.roth! The ‘name’ entry works, without needing to modify the plugin source code!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category order’ is closed to new replies.