In our site we used to display categories and products in different separate sections when display type was set to 'both' using woocommerce_product_subcategories() function.

I have recently updated woocommerce to the latest v3.4.3 and found out that the function woocommerce_product_subcategories() has been deprecated. Now they have introduced different functions to display categories, like woocommerce_output_product_categories(), woocommerce_maybe_show_product_subcategories().

But the problem I'm having is that, I could not stop showing categories in product loop. It keeps showing both categories and products in the same loop.

Can anyone show me a way, how I can display categories and products in a separate section?


To clarify my question, in my category settings, display type is set to both.

category setting

When I'm browsing category archive page, both category and products are showing in the loop.

enter image description here

What I want, is to separate categories from the loop and show it in a different section. In the loop, I want to display only products.

  • Your question is very confusing. Did you customize the WooCommerce shop pages? Did you use filters/actions to filter the WooCommerce results? Details are needed before anyone can really be of any assistance.
    – Steve
    Commented Jul 5, 2018 at 17:48
  • I have edited my question. Hope this will simplify to understand the problem.
    – Arif
    Commented Jul 5, 2018 at 18:09
  • The screenshot 'Display Type' is either a) a very old version of WooCommerce, b) a theme control, or c) a custom plugin. But it is definitely not native WooCommerce. Without knowing what theme or plugin you are using there isn't much we can do to help.
    – Steve
    Commented Jul 5, 2018 at 18:18
  • It is actually native to WC. Only plugin active is WooCommerce, and I'm using Storefront theme. Everything is updated to its latest version.
    – Arif
    Commented Jul 5, 2018 at 18:24
  • Not native WooCommerce, a Storefront theme control. You'll have to work with WooCommerce support to address the issue.
    – Steve
    Commented Jul 5, 2018 at 18:30

3 Answers 3


I have found the solution I was looking for. Using the following code will stop displaying categories in the product loop.

remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );

Then use the following function in a separate section of the page will render the categories in a separate section. woocommerce_maybe_show_product_subcategories()


Based on @Arif answer.

In function.php

// remove the subcategories from the product loop
remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );

// add subcategories before the product loop (yet after catalog_ordering and result_count -> see priority 40)
add_action( 'woocommerce_before_shop_loop', 'wp56123_show_product_subcategories', 40 );

function wp56123_show_product_subcategories() {
    $subcategories = woocommerce_maybe_show_product_subcategories();
        if ($subcategories) {
          echo '<ul class="subcategories">',$subcategories,'</ul>';

Tested on Woocommerce 3.9

  • Faced the same problem. Solution from Vanois.be works, till I apply filter based on taxonomies. Than I recieved duplicated output based on applied filter. Commented Sep 4, 2020 at 12:01

Take a look at this tutorial. It is updated to the latest version of Woocommerce (3.6).

The tutorial on Tutsplus is great but no longer up to date.

Not the answer you're looking for? Browse other questions tagged or ask your own question.