Home Forums WoodMart support forum Hide categories Shop Page

Hide categories Shop Page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #208057

    apolo
    Participant

    Hello!
    I used this script in functions.php to hide the category “produto-de-limpeza” this category only appeared on a separate page. So far so good, it worked perfectly.

    *************************************************
    This is the code used.

    add_action( ‘woocommerce_product_query’, ‘prefix_custom_pre_get_posts_query’ );

    function prefix_custom_pre_get_posts_query( $q ) {

    if( is_shop() || is_page(‘awards’) ) {

    $tax_query = (array) $q->get( ‘tax_query’ );

    $tax_query[] = array(
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => array( ‘produto-de-limpeza’ ),
    ‘operator’ => ‘NOT IN’
    );

    $q->set( ‘tax_query’, $tax_query );
    }
    }
    ***********************************************************************

    BUT when I do a product search when I click View all results it appears that no products were found.

    I would like to know if there is any way to just remove the category from the shop page but still keep working when clicked on View all results in searching for products

    #208065

    Artem Temos
    Keymaster

    Hello,

    Sorry, but this functionality is related to WooCommerce plugin and our theme doesn’t influence it. Also, any third-party codes and additional customizations are not covered by our support service.

    Thank you for understanding.

Viewing 2 posts - 1 through 2 (of 2 total)