Hi,
I’m using WooCommerce and Enfold.
Is it possible to hide a particular category from the shop view?
I want to hide the ‘Lumifil’ category.
Thanks,
Harvinder
Hey ballindigital,
Try this article from the woocommerce documentation: Exclude products from a particular category on the shop page
Best regards,
Mike
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?
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;
}
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