skip to Main Content

I need to remove category title from woo-commerce product category pages.

Any hook for removing category title same as product title hook? I have googled and tried so many things for it but didn’t found right solution. Found hook for removing product title.

remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );

Need a hook same like above for removing category title.

Is any hook for category title?

2

Answers


  1. The Function woocommerce_template_loop_category_title() is responsible to return the title of category on shop or category page in woocommerce You can see here for more details

    using hook 1st method

    remove_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title', 10, 2 ); 
    

    using css 2nd method

    function remove_cat_title_from_cat_or_shop_page($category){
        if ( is_product_category() || is_shop() ) {
            echo"<style>";
            echo".woocommerce ul.products li.product .woocommerce-loop-category__title{display:none!important;}";
            echo"</style>";
        } 
    }
    add_filter( 'woocommerce_before_shop_loop', 'remove_cat_title_from_cat_or_shop_page');
    

    result
    enter image description here

    Login or Signup to reply.
  2. I guess your Theme is overriding the hook

    woocommerce_after_shop_loop_item_title
    

    woocommerce_after_shop_loop_item_title hook is responsible to return the title. In my case also this was an issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search