Support » Plugin: YITH WooCommerce Bulk Product Editing » Filter Category is not usable

  • Resolved gck303

    (@gck303)


    I am using the latest version of this plugin.

    The ‘filter categories’ option is not usable. I have around 300 category nodes arranged in a structured 4 level hierarchy.

    The dropdown box is not sorted correctly. It looks to be sorted by the internal ‘ID’.

    For this to be usable it needs to work in one of the following ways:
    – sorted by description
    – arranged as a proper hierarchy structure, so I can navigate through the hierarchy to the node I am after
    – sorted by and display the slug

    My preference would be for the last!

    Many thanks, George

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

    (@yithemes)

    Hi George,
    and thank you for writing in!

    You can sort the categories by slug and display the slug after product category name by adding the following code snippet in your theme functions.php:

    if ( !function_exists( 'yith_wcpb_customization_categories' ) ) {
        function yith_wcpb_customization_categories( $terms, $taxonomy, $query_vars, $term_query ) {
            $is_bulk_page = function_exists( 'get_current_screen' ) && strpos( get_current_screen()->id, '_yith_wcbep_panel' );
            if ( $is_bulk_page && in_array( 'product_cat', $taxonomy ) && !!$terms ) {
                usort( $terms, function ( $t1, $t2 ) {
                    return isset( $t1->slug ) && isset( $t2->slug ) ? strcmp( $t1->slug, $t2->slug ) : 0;
                } );
                foreach ( $terms as $key => $term ) {
                    if ( isset( $term->slug ) && isset( $term->name ) ) {
                        $terms[ $key ]->name = $term->name . " ($term->slug)";
                    }
                }
            }
    
            return $terms;
        }
    
        add_filter( 'get_terms', 'yith_wcpb_customization_categories', 10, 4 );
    }

    Please try it and let us know if everything works fine!

    Best Regards
    YITH Support

    Thread Starter gck303

    (@gck303)

    Thank you very much. That works perfectly!

    I can now see the category description and slug. They are now ordered by slus, so I can easily find things.

    George

    • This reply was modified 6 years, 6 months ago by gck303.
    Plugin Author YITHEMES

    (@yithemes)

    Hi George,
    You are welcome!

    If you like the plugin and our support, please, support us with a 5-star review. It takes just a minute. Thank you!

    Best Regards
    YITH Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter Category is not usable’ is closed to new replies.