Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1411165

    Hi,

    I’m using WooCommerce and Enfold.

    Is it possible to hide a particular category from the shop view?

    https://www.rosevel.ie/shop

    I want to hide the ‘Lumifil’ category.

    Thanks,

    Harvinder

    #1411220

    Hey ballindigital,
    Try this article from the woocommerce documentation: Exclude products from a particular category on the shop page

    Best regards,
    Mike

    #1411269

    I believe this is excluding products from a category.

    I want to hide a category from the shop page.

    Is there a way to do that?

    #1411270

    Actually.. I used ChatGPT to help me work out the code and it suggested this and it worked:

    /**
    * Hide a specific product category from category list on shop page
    */
    add_filter( ‘get_terms’, ‘hide_product_category’, 10, 1 );
    function hide_product_category( $terms ) {

    foreach ( $terms as $key => $term ) {

    if ( ‘product_cat’ == $term->taxonomy && ’51’ == $term->term_id ) { // Replace ’51’ with your category ID
    unset( $terms[$key] );
    }

    }

    return $terms;
    }

    #1411305

    Hi,
    Glad to hear that you have this sorted out, and thanks for sharing your solution, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Hide Category’ is closed to new replies.