Support » Plugin: WooCommerce » Show only specific Product Categories on homepage

  • This seems to have been covered in bits in the past but I can’t find a full explanation for this particular problem.

    I’m using WooCommerce with the Mystile theme, and I’m trying to find the simplest and most efficient way to show ONLY TWO of the main categories on the homepage. So I either need to find a way to hide all the other categories AND subcategories, or code to show only categories 20 and 21 (these are the category IDs)

    I started by trying to find out how to disable the subcategories but the only info I can find on this is from earlier versions of WooCommerce e.g.

    I have also been looking at how to exclude categories using wp_list_categories but I’m not sure if I can transfer the categories-template.php to a child theme, or even if I need to. I’m also not sure that’s the most efficient solution to the problem, especially as we may be adding more categories and subcategories in the future which will also need to be hidden.

    Can anyone provide a solution?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hello, I think that I have the solution.

    Modify in “theme-woocommerce.php” file (in themes\mystile\includes) the line 651:

    echo do_shortcode(‘[product_categories number=””‘);

    Option 1 – if you like to show only the main categories:
    echo do_shortcode(‘[product_categories number=”” parent=0’);

    Option 2 – if you like to show only some ids:

    echo do_shortcode(‘[product_categories number=”” ids=”20,21″‘);

    Please test it and give me your feedback.

    (Sorry for my english)

    No. Look at update 1.2.14, it’s filter able, no edit required

    Hello this is something I need – please does anyone know how to apply the filter?

    thanks for reply. I did already find this and try it in wp-content/themes/mystile/functions.php but got no joy.

    Changing the home page to a static page in /settings/reading and then using [product_categories number=”” parent=”0″] almost gets me what I want but it bugs me that i cant get it going….

    Have you added a support ticket to the Mystile developer? I have sent requests all the time and he gets it done (star rating, remove twitter, etc). If you do contact him, tell him to add captcha to the contact for like Canvas uses!

    I will have a another look today and contact div if I need to. Will post a solution here if I find one/get given one. Thanks for input 🙂

    This might be a dumb question but in Mystile theme options under Layout Options it has an area for

    Specify a comma seperated list of category IDs or slugs that you’d like to exclude from your homepage (eg: uncategorized).

    You did try this right?

    I did see that thanks. However I am currently populating and controlling the stock levels shop(s) using csv import plugin, and this import will eventually be automated. To then have to go in and tidy the categories from the front page of each shop is kind of out the question… I realise that I am getting into the realms of a bespoke/theme perhaps but the mystile theme ticks so many boxes.




    Did you managed to get this solved, I am in the exact same position as you, mystyle with woocommerce and an automated product importer. I just want to display certain categories on a page and the shortcode Product_categories with the argument ids does not work.


    1) edit this file theme-woocommerce.php (includes/theme-woocommerce.php)
    2) find it “function mystile_product_categories() {“

    3) copy these lines

    add_filter( 'mystile_homepage_product_categories_params', 'homepage_parent_categories_only' );
    function homepage_parent_categories_only( $params ) {
        $params = 'parent="0"';
    	return $params;

    4) paste it after line that you found in item 2
    5) Save

    @atesdanis … Perfect, it works!

    Paste code JUST BELOW of “function mystile_product_categories() {“

    Thanks again !

    i m a newbie to wordpress and i dont know about codes as well.

    i have a kind of same problem but i want a code and a way to hide some of the catagories from my mystyle homepage.

    i am using mystyle theme
    i want to know in which file i will add code?
    where exactly?
    i noticed mystyle theme-functions.php have some code for exclude catgories but i dont know where should i put the ID of catagories.

    please can someone help?

    @atesdanis Thank You – your solution worked for me as well!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Show only specific Product Categories on homepage’ is closed to new replies.