Support » Plugin: WooCommerce » Hide categories from product listing

  • WC version 2.5.2

    Need to hide category listing in product view but would like to keep it in code or just remove it totally.

    Tried this but it doesn’t work:

    function mango_child_template_loop_product_link_open() {
    	echo '<!-- ';
    }
    function mango_child_template_loop_product_link_close() {
    	echo ' //-->';
    }
    remove_action( 'woocommerce_before_subcategory', 'woocommerce_template_loop_category_link_open');
    add_action( 'woocommerce_before_subcategory', 'mango_child_template_loop_product_link_open', 10 );
    remove_action( 'woocommerce_after_subcategory', 'woocommerce_template_loop_category_link_close' );
    add_action( 'woocommerce_after_subcategory', 'mango_child_template_loop_product_link_close', 10 );

    https://wordpress.org/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • To remove it totally I tried also this in theme functions.php

    remove_action( 'woocommerce_before_subcategory', 'woocommerce_template_loop_category_link_open' );
    remove_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title' );
    remove_action( 'woocommerce_after_subcategory', 'woocommerce_template_loop_category_link_close' );
    Plugin Author Mike Jolley

    (@mikejolley)

    Can you screenshot what you’re removing? If its categories on archives you can control this in settings, no need for code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide categories from product listing’ is closed to new replies.