Home  >  Q&A  >  body text

Remove product category block from home page of WooCommerce storefront theme

<p>I'm trying to remove the default product categories section block shown in the WooCommerce Storefront theme homepage. </p> <p>I tried removing the block by using a couple of hooks in functions.php, for example: </p> <pre class="brush:php;toolbar:false;">function remove_storefront_category() { remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper', 9); remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20); remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30); remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper_close', 31); remove_action( 'woocommerce_after_shop_loop', 'woocommerce_reset_loop', 999); } add_action( 'woocommerce_after_shop_loop', 'remove_storefront_category' );</pre> <p>But no matter what I try, this product category section block won't disappear. </p> <p>I searched a lot and only found information about hiding a specific category, but I want to hide it completely. </p>
P粉908138620P粉908138620385 days ago546

reply all(1)I'll reply

  • P粉322106755

    P粉3221067552023-09-04 11:21:56

    To remove the product categories section from your storefront theme home page, you can use the following simple code snippet:

    add_action( 'init', 'remove_storefront_home_product_categories', 10 );
    function remove_storefront_home_product_categories(){
        // Unhook storefront_product_categories() function from 'homepage' action hook
        remove_action( 'homepage', 'storefront_product_categories', 20 );
    }

    The code is located in the functions.php file of the active child theme (or active theme). Tested and works.

    reply
    0
  • Cancelreply