×



















    Get a Free Consultation

    Search for:

    How To Hide a Category In WooCommerce From The Shop Page

    Last Updated | May 16, 2023

    Executive Summary:

    You may learn how to hide a category in WooCommerce from your shop page by consulting the guidelines we at Folio3 have provided below.

    The shop page is the most crucial page for an eCommerce website because it is where the majority of transactions take place and where customers may view the items for sale.

    The WooCommerce development company shop page must be perfect in every way, from presentation to functionality.

    For some people, it’s acceptable but not for others that all the products from every category are displayed by default.

    You could wish to limit the categories that are displayed on your WooCommerce integration shop page, but you don’t know how.

     If you want to roll your sleeves up and setup a WooCommerce Store from Scratch, there’s a step-by-step guide on how to setup WooCommerce store.

    Reasons For Why You Want To Know How To Hide A Category In WooCommerce Store

    There can be a thousand reasons why a merchant becomes eager to learn how to hide a category in WooCommerce.

    Reason #1 – Customers’ Encouragement

    You have the option to allow certain user roles to purchase products while keeping them hidden from the general public.

    In this approach, you can give particular user groups, like members, a feeling of exclusivity.

    Therefore, existing consumers will need to sign up for membership before they can purchase the hidden goods.

    Reason #2 – Members And Employees With Special Pricing

    If you manage a membership website, you already understand the benefits of providing discounted rates for expanding your clientele and increasing sales.

    By using differential pricing on your eCommerce site, you may offer your site’s members a better deal, which entices non-members to become subscribers.

    Similar to in-store promotions, several online retailers provide staff members with the opportunity to save money on purchases.

    Reason #3 – Sell Merchandise To Retail And Wholesale Stores

    The products and prices offered for each type of consumer must be clearly differentiated if you sell to both retail and wholesale customers on the same e-commerce website development.

    You can achieve this by shielding retail customers from wholesale-only product categories. Retail customers won’t be able to see products that are exclusively offered at bulk discounts in this fashion.

    The article would be a kind of tutorial on how to hide a category in WooCommerce store individually if you want to limit access to only a small number of your products.

    Simple Steps on How to Hide a Category in WooCommerce

    On how to hide a category in WooCommerce, we will be addressing two simple ways;

    1. Hiding the category using the “woocommerce_product_query_tax_query” filter
    2. Hiding the category using the get_terms filter
    • The “woocommerce_product_query_tax_query” Filter

    The first method is to conceal uncategorized products from the shop page using the WooCommerce product query action. The functions.php file must contain this. Add the following code:

    add_action( ‘woocommerce_product_query’, ‘prefix_custom_pre_get_posts_query’ );

    /**

    * Hide Product Categories from targeted pages in WooCommerce

    * @link https://gist.github.com/stuartduff/bd149e81d80291a16d4d3968e68eb9f8#file-wc-exclude-product-category-from-shop-page-php

    *

    */

    function prefix_custom_pre_get_posts_query( $q ) {

    if( is_shop() || is_page(‘awards’) ) { // set conditions here

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

    $tax_query[] = array(

    ‘taxonomy’ => ‘product_cat’,

    ‘field’ => ‘slug’,

    ‘operator’ => ‘NOT IN’

    );

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

    }

    }

    This code should be used on sites where the Product Categories shouldn’t be displayed. The category you want to delete must have their values set in the $tax query array.

    When determining whether the page already includes a “is shop()” function, we use the “woocommerce product query tax query” filter. To narrow down the search, we can add additional taxonomy search criteria.

    Then include an array that trims or eliminates the appropriate categories from their taxonomy slugs.

    • The get_terms Filter

    In order to prevent the generic “uncategorized” category from appearing and rendering the site more confusing and unattractive, you will choose to hide some of the categories from view on your store page.

    It could simply be removed from the shop page, or the category name could be changed to something more appropriate. It can be hidden using this approach.

    1. Create a category slug first, go to the WordPress dashboard and click on Products > Categories.

    “Uncategorized” will serves as the category’s slug.

    1. Enter the following code into functions.php to make the uncategorized slug invisible for your child theme.

    The get terms feature is now part of the category. There shouldn’t be any more indication of the “Uncategorized” category.

    You can next input the slug names for every category you want to hide:

    add_filter( ‘get_terms’, ‘ts_get_subcategory_terms’, 10, 3 );

    function ts_get_subcategory_terms( $terms, $taxonomies, $args ) {

    $new_terms = array();

    // if it is a product category and on the shop page

    if ( in_array( ‘product_cat’, $taxonomies ) && ! is_admin() &&is_shop() ) {

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

    if ( !in_array( $term->slug, array( ‘uncategorised’,’furniture’ ) ) ) { //pass the slug name here

    $new_terms[] = $term;

    }}

    $terms = $new_terms;

    }

    return $terms;

    }

    This code will hide the items under the “Uncategorized” and “furniture” categories.

    Using either of these two methods to answer your question – how to hide a category in WooCommerce, you can hide from the shop page with either of them.

    Read: 20 advanced ways to optimize and speed up WooCommerce store in 2022

    Two Ways To Allow Users to See Protected Categories

    You can allow users to see protected categories in the following two ways;

    • Via Members Only

    Members Only is the quickest plugin to configure. 

    1. Install and activate the Members Only plugin
    2. Go to WooCommerce > Settings > Members Only and view the settings.

    For international Members Only settings;

    Simply change the ‘Restricted Content’ column to ‘Specified Categories’ if you want to create protected categories.

    You can put your limited categories in the “Restricted Categories” area at this time if you really want to filter all categories in the very same manner.

    • Via Password Or User Role

    We also need to alter the “Restriction Method” box to either “Password” or “User Role” because we want to create different restriction rules for various categories.

    Access can also be restricted based on a user’s logged-in status.

    To speed up WooCommerce checkout process for the WooCommerce store, use the recommendations in this article.

    Plugins That Can Help Hide the Categories On Your WooCommerce Store

    There are 3 plugins which are considered the best in the quest of how to hide a category in WooCommerce on the Shop Page

    1. WooCommerce Products Visibility

    The WooCommerce Products Visibility is also an amazing plugin to learn about when you are learning how to hide a category in WooCommerce.

    you can specify which products are displayed throughout the entire site for each user role.

    Keep in mind that the ONLY plugin that enables you to set combination visibility rules is WooCommerce Products Visibility. In other words, you can simultaneously hide products, categories, and tags for a given function.

    As long as it uses standard WordPress filters, it’s also the only plugin that conceals the specified goods, categories, and tags throughout your entire site, encompassing menus, widgets, and even the theme.

    1. WooCommerce Protected Categories

    This WooCommerce Protected Categories plugin is distinctive in that it was created especially for websites that serve solitary customers. You can password-protect and conceal a category on your website.

    Give your customer the password after which they can navigate a catalog of goods that have already been specially chosen for them. Additionally, you have the option to restrict protected categories to “user roles” rather than specific people.

    1. Hide Categories Or Products On Shop Page

    The Hide Categories Or Products On Shop Page is a WooCommerce addon that allows users to conceal categories or products on the Shop Page.

    It is possible to hide categories and goods in WooCommerce from the shop page. This WooCommerce-compatible plugin is free.

    Final Words

    Making your shop page simpler to use and manage requires the WooCommerce design shop page hiding category function.

    It makes it simple for you to arrange your products and classify them into the relevant groups.

    Customers love it because they can pick and choose the items they want, which raises customer satisfaction and raises traffic, sales, and conversion rates.

    This guide on how to hide a category in WooCommerce on the shop page is essential.

    If you need assistance in other eCommerce solutions like WooCommerce migration, BigCommerce web design company, Salesforce Commerce Cloud Development, or Salesforce Commerce Cloud we would be glad to help you out!

    FAQs

    How do I hide specific category on shop page?

    If you want to create protected categories, change the “Restricted Content” column to “Specified Categories.”

    If you absolutely want to filter all categories, in the same way, you can now enter your restricted categories in the “Restricted Categories” field.

    How do I hide categories from being displayed on shop page WooCommerce B2B?

    Go to WooCommerce > Settings > Products. Go to the subsection “Hide from categories”.

    And that’s about it, you are done. 

    How do I hide a category from a single product page in WooCommerce?You can with WooCommerce conceal a category from a single product page by using a plugin.

    • First, install and turn on the plugin. The plugin must first be downloaded from barn2.com.
    • Setting up the plugin, step two. Navigate to WooCommerce > Settings in the following step.
    • Choose which categories to conceal in step three.
    • Edit category visibility in step four.

    Related Articles:
    1) WooCommerce Security
    2) Woocommerce Audit
    3) WooCommerce features


    folio-social-logo
    About

    Folio3, a Software Powerhouse established in 2005, is one of the leading eCommerce solution providers for SMBs and Fortune 500. The Company has expertise in diverse industries such as Animal Care, Retail, Automotive, Food and Agriculture, and Health care. From ecommerce store design and development to full-scale ERP deployment and integration, Folio3 has done it all.