• Is there a way to get rid of the “Product Categories” sidebar on the Woocommerce Shop page? I don’t and won’t have categories.

    For that matter, if I could also get rid of the search box it would be neater and cleaner.

    Otherwise, I’d add a paragraph or something welcoming above the search box.

    I’m after friendly!

    Dixie Duckies

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi, JodieRD.

    If you’re comfortable with copying and tweaking PHP, try using this snippet I found at WPExplorer.com into your theme’s functions.php file:

    add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
    2
    
    3
    function custom_pre_get_posts_query( $q ) {
    4
    
    5
        if ( ! $q->is_main_query() ) return;
    6
        if ( ! $q->is_post_type_archive() ) return;
    7
    
    8
        if ( ! is_admin() && is_shop() && ! is_user_logged_in() ) {
    9
    
    10
            $q->set( 'tax_query', array(array(
    11
                'taxonomy' => 'product_cat',
    12
                'field' => 'slug',
    13
                'terms' => array( 'color', 'flavor', 'spices', 'vanilla' ), // Don't display products in these categories on the shop page
    14
                'operator' => 'NOT IN'
    15
            )));
    16
    
    17
        }
    18
    
    19
        remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
    20
    
    21
    }

    Caveat: I haven’t tried this out myself; and it may just remove specific product categories.

    Actually before doing that, all you may need to do is customize the sidebar widget. You can do that in your WordPress Dashboard by:

    • Going to “Appearance” > “Widgets”
    • Selecting the sidebar of the page you want to modify
    • And finally adding in the widgets you want in it

    That should clear out the default widgets (like the search, too) from the sidebar.

    Thread Starter JodieRD

    (@jodierd)

    Ha! I simply added a text widget and it appeared and the others presto changeo disappeared!
    Stephen thank you so much! The kindness of strangers … ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fruitful Woocommerce Shop Page Categories’ is closed to new replies.