• Resolved carryoncoding

    (@carryoncoding)


    We have a very long list of categories and sub-categories.

    I want to provide a drop-down that only contains 2 of those categories. Is there away to hide certain categories so that only a sub-set shows?

    Very many thanks,
    Phil.

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

    (@kowsar89)

    Currently that’s not possible.

    The dropdown is created with Select2 box so even if you have a long list of categories, you can search for specific category easily if you start typing into that dropdown

    Thread Starter carryoncoding

    (@carryoncoding)

    Thanks Lowsar.

    Thread Starter carryoncoding

    (@carryoncoding)

    This is now fixed with a local modification. In case anyone else needs to do this:

    Modify file: plugins/woocommerce-filter-orders-by-product/inc/filter-by-category.php

    Change your category IDs as needed.

    public function dropdown_fields(){
    	
    $terms = get_terms( array('taxonomy' => 'product_cat', 'fields' => 'id=>name' ) );
    $fields = array();
    $fields[0] = esc_html__( 'All Orders', 'woocommerce-filter-orders-by-product' );
    $fields[59] = 'Restaurant 1';
    $fields[60] = 'Restaurant 2';
    //		foreach ( $terms as $id => $name ) {
    //			$fields[$id] = $name;
    //		}
    return $fields;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide certain categories’ is closed to new replies.