Remove Product Categories Block from home page in WooCommerce Storefront Theme

209 Views Asked by At

I am trying to remove the default product categories section block that is shown from home page in WooCommerce Storefront theme .

Screenshot

I have tried to remove that block by using several hooks in the functions.php like for example:

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' );

But no matter what I am trying, this product categories section block won't go away.

I have searched a lot and only found information about hiding specific categories, but I want to hide it completely.

1

There are 1 best solutions below

0
LoicTheAztec On

To remove from the Storefront theme home page, the product categories section, 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 );
}

Code goes in functions.php file of your active child theme (or active theme). Tested and works.