Turning off Categories - by roosites - on WordPress WooCommerce support

This topic has 9 replies, 3 voices, and was last updated 7 years, 4 months ago ago by Jack Richardson

  • Avatar: roosites
    roosites
    Participant
    November 29, 2016 at 13:18

    Hi – I am building a site for a client that has seasonal categories such as Christmas. I would like to have this category now display at certain times of the year. I removed it from my menus but it shows under Product Categories on my homepage and under categories on my product pages.

    Any way to hide a category, or turn off and back on that work with this theme?

    Thanks!

    Please, contact administrator
    for this information.
    8 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    November 29, 2016 at 17:09

    Hello,

    Try to add this code in functions.php file:

    add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
    function custom_pre_get_posts_query( $q )
    {
    
    if (!$q->is_main_query() || !is_shop()) return;
    if ( ! is_admin() )
    {
    $q->set( 'tax_query', array(array(
    'taxonomy' => 'product_cat',
    'field' => 'id',
    'terms' => array( 57 ),
    'operator' => 'NOT IN'
    )));
    
    }
    }

    where 57 is a category id, replace it with your id.

    Regards,
    Eva Kemp.

    Avatar: roosites
    roosites
    Participant
    November 29, 2016 at 17:28

    Thanks Eva but it is still appearing everywhere. You can see, thanksgiving category.

    Avatar: Eva
    Eva Kemp
    Support staff
    November 29, 2016 at 19:46

    Hello,

    Please provide FTP and WP Dashboard credentials in private content.

    Regards,
    Eva Kemp.

    Avatar: roosites
    roosites
    Participant
    November 29, 2016 at 19:58

    See in private

    Please, contact administrator
    for this information.
    Avatar: Eva
    Eva Kemp
    Support staff
    November 29, 2016 at 20:27

    Hello,

    I’ve added this code in child style.css:

    .cat-item.cat-item-110 {
        display: none;
    }

    and “Thanksgiving” category is hidden in sidebar in Shop page.
    As for home page, I recommend you to use Woo Product Categories element in Visual Composer editor and select what categories to display.
    Please try it.

    Regards,
    Eva Kemp.

    Avatar: roosites
    roosites
    Participant
    November 30, 2016 at 20:39

    Thanks, I will try that. I just noticed something else broken, not sure if it is related to any of the fixes. For some reason now the dropdown menu doesn’t work. When I hover over Occasions or any of the others on the main menu nothing happens. Can you check this out as soon as possible please as I would like to launch tomorrow?

    Thanks

    Avatar: roosites
    roosites
    Participant
    November 30, 2016 at 21:20

    See below

    Please, contact administrator
    for this information.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    December 1, 2016 at 12:01

    Hello,

    Ok, let us know if further assistance is needed.

    Best regards,
    Jack Richardson.

  • Viewing 9 results - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.