• Dear Marcel,
    I would like to set a custom order only at the Products page with the top product categories. All below should be alphabetical. How to achieve that?

    Thanks for the previous help 2 years ago! This one is needed as because of that custom order on the shop/products page, all below can’t use the alphabetical order. And I have over 1600 proodct categories with 1>2>3 level deepness.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marcel Pol

    (@mpol)

    Hi,
    Interesting question ??

    If I get it right, on any page you want to use the setting as “alphabetical” and on the product page you want the setting as “custom order”.
    Could it be a solution to create a PHP filter so that on this products page the setting gets dynamically changed to “custom order”? That filter can check the page ID or maybe a WooCommerce template function for checking the products page.
    I see there is no filter for that yet, but if desired that should be possible.

    Would this help you?
    Did I get it wrong or do you prefer a different approach?

    I do understand this plugin has a singular approach to sorting, all terms in a taxonomy get sorted the same way accross the whole website. It might be good to offer more options for a finer grained approach.

    Thread Starter BG2021

    (@enikolov)

    Yes, you understood correctly. Just to clarify – I talk only for product category pages,not other taxonomies. Would be nice as a function. As the shop page is the face of each online shop I think that feature could be of good use to many users. As exactly there noone wants the alphabetical order. But underneath in the sub-category many would want alphabetical. Especially if it’s about car brands. Could this be added?

    Plugin Author Marcel Pol

    (@mpol)

    Hi,
    In git there is now a filter added that should make this possible:
    https://gitlab.com/toomanybicycles/custom-taxonomy-order-ne
    It is the only change since 3.3.2, so it should be safe to use.

    After installing that, you can use this custom code in functions.php of your theme or your own custom plugin.
    I am not sure which pages all identify as is_shop(), I do hope it is all the translated pages, but no other archive pages.

    /*
     * Settings:
     * 0: orderby Term ID
     * 1: orderby Custom Order
     * 2: orderby Term Name (alphabetical)
     * 3: orderby Term Slug (alphabetical)
     */
    function my_customtaxorder_settings( $settings ) {
    	//var_dump( $settings['product_cat'] );
    	if ( function_exists( 'is_shop' ) ) {
    		if ( is_shop() ) {
    			$settings['product_cat'] = 1;
    		}
    	}
    	//var_dump( $settings['product_cat'] );
    	return $settings;
    }
    add_filter( 'customtaxorder_settings', 'my_customtaxorder_settings' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Product categories sort > how to sort just the sub-terms / sub-categories’ is closed to new replies.