Keeping your e-commerce website's products neatly categorized and properly organized can make it easier for customers to find the items they need. However, it can be troublesome for large e-commerce sites with tons of product categories.
However, it is possible to get the best out of the Creating Categories and Subcategories to neatly arrange products, thus improving the shopping experience for customers and making it easier for them to navigate the store. This cannot be ignored.
In the article, we will step by step guide How to get started in the WooCommerce store Show product categories and subcategoriesIt's a great way to help your website improve the user experience.
whether WooCommerce Newbie nevertheless veteran of e-commerce, all of these tips help.
![Image[1]-WooCommerce Store Product Category Guide: How to Show, Hide and Optimize Product Categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224171134230-image.png)
Why show product categories in WooCommerce?
There are several important reasons to display product categories in your WooCommerce store:
- Easy to navigate: Clear categorization allows customers to quickly find the products they need, enhancing the shopping experience.
- Better product organization: Reasonable categorization can make the layout of the store more tidy and improve the browsing efficiency of users.
- raise SEO rankings: Using relevant keywords in the name of the category helps the website to rank better in the search engine results pages (SERPs).
- Helps with marketing and promotion: Showcasing product categorization for the convenience of customers also helps merchants to better promote specific products or events and increase conversion rates.
How to Show Default Categories, Subcategories and Products in WooCommerce
When setting up a WooCommerce store, it's common to select the "Show categories/subcategories and products" option, so that visitors can select products directly from the home page, or filter products by clicking on the product category page.
Ways to display categories in your WooCommerce store
Go to WooCommerce Settings
- leave for WooCommerce → Settings
Select Product Options
- strike (on the keyboard) offerings tabs
Adjusting display settings
- option demonstrate options (as in computer software settings)
- exist The store page shows respond in singing Default Category Display option, select Simultaneous display of categories and products(Show both)
Save Changes
- strike (on the keyboard) Save Changes button to apply the new settings
![Image [2] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224155248167-image.png)
![Image [3] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224155305506-image.png)
caveat
If required Customize the display of WooCommerce CategoriesIt can be modified with code functions.php
file (located in the Themes folder). To edit before Backup Sitesto prevent accidents from occurring.
How to Display Product Categories in WooCommerce
WooCommerce provides woocommerce_product_category()
function, which displays the product before outputting the Category or subcategory. This function is pluggable, meaning that it can be used in the topic rewrite to customize the display.
Steps:
- show (a ticket)
functions.php
file(located in the Themes folder). - Insert the following code, which is used to display product categories on the store page:
function woocommerce_get_product_category_of_subcategories( $category_slug ){$terms_html = array();$taxonomy = 'product_cat';$parent = get_term_by( 'slug', $category_slug, $taxonomy );$children_ids = get_term_children( $parent->term_id, $taxonomy );foreach($children_ids as $children_id){$term = get_term( $children_id, $taxonomy );$term_link = get_term_link( $term, $taxonomy );if ( is_wp_error( $term_link ) ) $term_link = '';$terms_html[] = '<a href="/en/' . esc_url( $term_link ) . '/" rel="tag" class="' . $term->slug . '">' . $term->name . '</a>';}return '<span class="subcategories-' . $category_slug . '">' . implode( ', ', $terms_html ) . '</span>';}function woocommerce_get_product_category_of_subcategories( $category_slug ){ $terms_html = array(); $taxonomy = 'product_cat'; $parent = get_term_by( 'slug', $category_slug, $taxonomy ); $children_ids = get_term_children( $parent->term_id, $taxonomy ); foreach($children_ids as $children_id){ $term = get_term( $children_id, $taxonomy ); $term_link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $term_link ) ) $term_link = ''; $terms_html[] = '<a href="/en/' . esc_url( $term_link ) . '/" rel="tag" class="' . $term->slug . '">' . $term->name . '</a>'; } return '<span class="subcategories-' . $category_slug . '">' . implode( ', ', $terms_html ) . '</span>'; }function woocommerce_get_product_category_of_subcategories( $category_slug ){ $terms_html = array(); $taxonomy = 'product_cat'; $parent = get_term_by( 'slug', $category_slug, $taxonomy ); $children_ids = get_term_children( $parent->term_id, $taxonomy ); foreach($children_ids as $children_id){ $term = get_term( $children_id, $taxonomy ); $term_link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $term_link ) ) $term_link = ''; $terms_html[] = '<a href="/en/' . esc_url( $term_link ) . '/" rel="tag" class="' . $term->slug . '">' . $term->name . '</a>'; } return '<span class="subcategories-' . $category_slug . '">' . implode( ', ', $terms_html ) . '</span>'; }
Code Parsing:
get_queried_object_id()
: Get the category ID of the current query.get_terms( 'product_cat', $args )
: Get the subcategories under this category.woocommerce_subcategory_thumbnail( $term )
: Displays thumbnails of categories.get_term_link( $term )
: Get category links and display them on the front end.add_action( 'woocommerce_before_shop_loop', 'woocommerce_product_category', 100 );
: Mount the function to the WooCommerce store page before the product list cycle, ensuring that categories are prioritized for display.
Effect:
The code will be in the store page Displaying product categories allows users to browse categories before selecting specific products, improving the navigation experience.
![Image [4] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224155717556-image.png)
How to List Subcategories of WooCommerce Product Categories
Customized functions can be used, via the slug for the parent product category to get WooCommerce's subcategories and display them as hyperlinks.
Operational Steps:
- show (a ticket)
functions.php
file(located in the current theme's folder). - Insert the following code, which is used to get the list of subcategories under a certain category:
function woocommerce_get_product_category_of_subcategories( $category_slug ){$terms_html = array();$taxonomy = 'product_cat';$parent = get_term_by( 'slug', $category_slug, $taxonomy );$children_ids = get_term_children( $parent->term_id, $taxonomy );foreach($children_ids as $children_id){$term = get_term( $children_id, $taxonomy );$term_link = get_term_link( $term, $taxonomy );if ( is_wp_error( $term_link ) ) $term_link = '';$terms_html[] = '<a href="/en/' . esc_url( $term_link ) . '/" rel="tag" class="' . $term->slug . '">' . $term->name . '</a>';}return '<span class="subcategories-' . $category_slug . '">' . implode( ', ', $terms_html ) . '</span>';}function woocommerce_get_product_category_of_subcategories( $category_slug ){ $terms_html = array(); $taxonomy = 'product_cat'; $parent = get_term_by( 'slug', $category_slug, $taxonomy ); $children_ids = get_term_children( $parent->term_id, $taxonomy ); foreach($children_ids as $children_id){ $term = get_term( $children_id, $taxonomy ); $term_link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $term_link ) ) $term_link = ''; $terms_html[] = '<a href="/en/' . esc_url( $term_link ) . '/" rel="tag" class="' . $term->slug . '">' . $term->name . '</a>'; } return '<span class="subcategories-' . $category_slug . '">' . implode( ', ', $terms_html ) . '</span>'; }function woocommerce_get_product_category_of_subcategories( $category_slug ){ $terms_html = array(); $taxonomy = 'product_cat'; $parent = get_term_by( 'slug', $category_slug, $taxonomy ); $children_ids = get_term_children( $parent->term_id, $taxonomy ); foreach($children_ids as $children_id){ $term = get_term( $children_id, $taxonomy ); $term_link = get_term_link( $term, $taxonomy ); if ( is_wp_error( $term_link ) ) $term_link = ''; $terms_html[] = '<a href="/en/' . esc_url( $term_link ) . '/" rel="tag" class="' . $term->slug . '">' . $term->name . '</a>'; } return '<span class="subcategories-' . $category_slug . '">' . implode( ', ', $terms_html ) . '</span>'; }
Code Parsing:
get_term_by( 'slug', $category_slug, $taxonomy )
: Get the object of the specified classification.get_term_children( $parent->term_id, $taxonomy )
: Gets the IDs of all subcategories under the category.- (math.) ergodic
$children_ids
::- Get the subcategories of the
term
Object. - Get Category Links
get_term_link( $term, $taxonomy )
The - generating
<a>
Hyperlinks to display subcategory names.
- Get the subcategories of the
- Return HTML code, show all subcategories separated by commas.
Effect:
This code can be used on the WooCommerce store page Dynamic display of subcategories of a product categoryIt is easy for users to browse and filter products.
How to Display WooCommerce Category Descriptions
Available in WooCommerce Template files for product detail pages Add code to display the description information of the category to which the product belongs.
Code Description:
- pass (a bill or inspection etc)
wp_get_post_terms()
Get the current product's ClassifiedsThe - Iterate through the categorized array, get and output the categorized DescriptionThe
Code Example:
global $post;$args = array( 'taxonomy' => 'product_cat', );$terms = wp_get_post_terms($post->ID,'product_cat', $args);$count = count($terms);if ($count > 0) {foreach ($terms as $term) {echo '<div class="woocommerce-get-product-category">';echo $term->description;echo '</div>';}}global $post; $args = array( 'taxonomy' => 'product_cat', ); $terms = wp_get_post_terms($post->ID,'product_cat', $args); $count = count($terms); if ($count > 0) { foreach ($terms as $term) { echo '<div class="woocommerce-get-product-category">'; echo $term->description; echo '</div>'; } }global $post; $args = array( 'taxonomy' => 'product_cat', ); $terms = wp_get_post_terms($post->ID,'product_cat', $args); $count = count($terms); if ($count > 0) { foreach ($terms as $term) { echo '<div class="woocommerce-get-product-category">'; echo $term->description; echo '</div>'; } }
Effect:
This code will be in the Product Detail Page Displays the category to which the product belongs Descriptive Information, which facilitates the user to understand the details of the classification.
How to Create a Custom Plugin to Show WooCommerce Product Categories
In WooCommerce, this can usually be accomplished by adding the following to the functions.php
file to add code to display product categories and subcategories. If theI don't want to change it. functions.php
The
Solution: Create a custom plugin
Wrapping functionality into a plugin can Avoid modifying theme filesIt's okay. Enable or disable the feature at any time, more flexible.
Step 1: Create Plugin Folder
go into wp-content/plugins
directory, create a new folder in it, for example:361sale-products-categories-in-archives
Step 2: Creating the plug-in file
- In the folder just created.Create a new PHP file, named:
361sale-product.php
- Open that file and add the plugin basic information:
<?php/*** Plugin Name: WooCommerce Product Category* Description: Display WooCommerce categories on WooCommerce product pages**/<?php /** * Plugin Name: WooCommerce Product Category * Description: Display WooCommerce categories on WooCommerce product pages **/<?php /** * Plugin Name: WooCommerce Product Category * Description: Display WooCommerce categories on WooCommerce product pages **/
Step 3: Add Category Display Function
Add the following code to the plugin file to get and display the product categories and subcategories:
function 361sale_product_subcategories( $args = array() ) {}add_action( 'woocommerce_before_shop_loop', '361sale_product_subcategories', 50 );function 361sale_product_subcategories( $args = array() ) { } add_action( 'woocommerce_before_shop_loop', '361sale_product_subcategories', 50 );function 361sale_product_subcategories( $args = array() ) { } add_action( 'woocommerce_before_shop_loop', '361sale_product_subcategories', 50 );
Now add the following code snippet to the function:
$parentid = get_queried_object_id();$args = array('parent' => $parentid);$terms = get_terms( 'product_cat', $args );if ( $terms ) {echo '<ul class="product-cats">';foreach ( $terms as $term ) {echo '<li class="category">';woocommerce_subcategory_thumbnail( $term ).echo '<h2>'; echo 'echo '<a href="/en/' . esc_url( get_term_link( $term ) ) . '/" class="' . $term->slug . '">'; echo $term->name; echo $term->nameecho $term->name;echo '</a>'; echo 'echo '</h2>';echo '</li>';}echo '</ul>';}$parentid = get_queried_object_id(); $args = array( 'parent' => $parentid ); $terms = get_terms( 'product_cat', $args ); if ( $terms ) { echo '<ul class="product-cats">'; foreach ( $terms as $term ) { echo '<li class="category">'; woocommerce_subcategory_thumbnail( $term ). echo '<h2>'; echo ' echo '<a href="/en/' . esc_url( get_term_link( $term ) ) . '/" class="' . $term->slug . '">'; echo $term->name; echo $term->name echo $term->name; echo '</a>'; echo ' echo '</h2>'; echo '</li>'; } echo '</ul>'; }$parentid = get_queried_object_id(); $args = array( 'parent' => $parentid ); $terms = get_terms( 'product_cat', $args ); if ( $terms ) { echo '<ul class="product-cats">'; foreach ( $terms as $term ) { echo '<li class="category">'; woocommerce_subcategory_thumbnail( $term ). echo '<h2>'; echo ' echo '<a href="/en/' . esc_url( get_term_link( $term ) ) . '/" class="' . $term->slug . '">'; echo $term->name; echo $term->name echo $term->name; echo '</a>'; echo ' echo '</h2>'; echo '</li>'; } echo '</ul>'; }
The above code first gets the object of the current query and defines its ID as $parentid
The
It then uses the get_terms()
function to find the current category under the subcategoryThe
For each subcategory, the code will:
- expense or outlay
woocommerce_subcategory_thumbnail()
Show Category Thumbnails - Add a hyperlink outside of the category name to point to the category's Archive Page
Creating plug-in style files
- In the plugins folder create
css
catalogs - exist
css
directory to create thestyle.css
file - The main plugin file is named
cloudways-product.php
- Add the following code to the plugin file to load the CSS file::
function 361sale_product_cats_css() {wp_register_style( '361sale_product_cats_css', plugins_url( 'css/style.css', __FILE__ ) );;wp_enqueue_style( '361sale_product_cats_css' ).}add_action( 'wp_enqueue_scripts', '361sale_product_cats_css' );function 361sale_product_cats_css() { wp_register_style( '361sale_product_cats_css', plugins_url( 'css/style.css', __FILE__ ) );; wp_enqueue_style( '361sale_product_cats_css' ). } add_action( 'wp_enqueue_scripts', '361sale_product_cats_css' );function 361sale_product_cats_css() { wp_register_style( '361sale_product_cats_css', plugins_url( 'css/style.css', __FILE__ ) );; wp_enqueue_style( '361sale_product_cats_css' ). } add_action( 'wp_enqueue_scripts', '361sale_product_cats_css' );
This way, the plugin loads correctly style.css
, used to customize the display style of the subcategory.
How to show product categories on WooCommerce store page
Displaying product categories on the WooCommerce store page is very simple, just follow the steps below:
- Go to the WordPress backendHover over Appearance Button on.
- Click on "Customize". Options.
![Image [5] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224162920466-image.png)
- Scroll downFind WooCommerce > Product CatalogThe
![Image [6] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224162926134-image.png)
- Find "Store Page Display"(Shop Page Display) setting, click the drop-down menu and select the "Show classification"(Show Categories).
![Image [7] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224162951954-image.png)
- Save Changes, the store page now displays product categories.
![Image [8] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163138816-image.png)
This makes it easy to display the WooCommerce store page Product Classification, optimizing the user browsing experience.
In addition, the a side-bar (in software) respond in singing menu to show product categorization, and you can learn more about these methods later.
How to display product categories in the sidebar
exist a side-bar (in software) Displaying product categories is a great optimization strategy that allows shoppers to browse the store while Always see optional categorization, facilitating their further exploration of the product.
Setting method
- Go to the WordPress backendGo to Appearance > WidgetsThe
- locatea side-bar (in software)(Sidebar) and click on the drop down menu.
![Image [9] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163230918-image.png)
- Find "Product Categories" WidgetsThe
- Drag theWidget to Sidebarshore, and then customize the settings.
- Additional widgets can be addedFor example, price filtering, category filtering, etc., to enhance the functionality of the sidebar.
In this way, after displaying the product categories in the WooCommerce sidebar, customers can Easier browsing of products in different categories, enhance the shopping experience.
![Image [10] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163517232-image.png)
How to Display WooCommerce Product Categories in the Menu
Show in menu Product Classification It's a visual way to give customers a quick overview of the categories of products sold in the store.
![Image [11] - WooCommerce Store Product Category Guide: How to Show, Hide and Optimize Product Categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163719693-image.png)
Setting method
- Go to the WordPress backendGo to Appearance > MenuThe
![Image [12] - WooCommerce Store Product Category Guide: How to Show, Hide and Optimize Product Categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163719254-image.png)
- Click on "Screen Options" in the upper left corner.and then check the "Product Categories" (Product Categories)The
![Image [13] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163719147-image.png)
- In the left panel, the "Product Categorization" option will appear., click to expand to see all the categories in the store.
- Select the category to be added to the menuand then click "Add to Menu" Button.
![Image [14] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163726971-image.png)
- Click on "Save Menu". button to complete the settings.
![Image [15] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224163857438-image.png)
In this way, the WooCommerce store's product categories appear in the site's navigation menu, making it easy for customers to quickly browse and select items.
Other product categorization actions that may be required for WooCommerce stores
In some cases, it is necessary to harbor (i.e. keep sth hidden) maybe arrange in order Products are categorized, for example:
- Avoiding overlap between classifications
- Images already clearly show the categories, no need for additional labels
- Adapt the display of categories to specific needs
Here are some WooCommerce Product Category Related ActionsThis will help you to manage your store categories more flexibly.
How to Hide Product Categories in WooCommerce
In WooCommerce, you can hide product categories in the following two ways:
- Using plug-ins
- Usage Code
Method 1: Hide product categories with a plugin
It is possible to use Hide Categories and Products for WooCommerce plugin to hide categories. The plugin is a paid tool and costs $4.09/monthThe
![Image [16] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224164241478-image.png)
After installing and activating the pluginYou'll find it under WooCommerce Options. Product Visibility Setting.
![Image [17] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224164216497-image.png)
procedure
- go into WooCommerce → Products Visibility → Global VisibilityThe
- Select the product categories you want to hide.
- Save Changes, the hidden categories will disappear from the store page.
This method is suitable for users who do not want to change the code, simple and easy to manage.
How to Hide WooCommerce Product Categories with Code
It is also possible to hide product categories by using custom code. Here's a sample code that uses the get_term
Filters to control the display of product categories:
add_action( 'woocommerce_before_shop_loop', 'show_product_categories', 20 );function show_product_categories() {// Display product categoriesecho do_shortcode( '[product_categories]' ); } }}add_action( 'woocommerce_before_shop_loop', 'show_product_categories', 20 ); function show_product_categories() { // Display product categories echo do_shortcode( '[product_categories]' ); } } }add_action( 'woocommerce_before_shop_loop', 'show_product_categories', 20 ); function show_product_categories() { // Display product categories echo do_shortcode( '[product_categories]' ); } } }
How to Hide Product Category Title, Product Quantity and Sort by Category in WooCommerce
Hide WooCommerce Product Category Title
The following code can be used to Hide product category title::
add_action( 'init', function() {remove_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title' , has_action( 'woocommerce_shop_ loop_subcategory_title', 'woocommerce_template_loop_category_title' ) ).} );add_action( 'init', function() { remove_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title' , has_action( 'woocommerce_shop_ loop_subcategory_title', 'woocommerce_template_loop_category_title' ) ). } );add_action( 'init', function() { remove_action( 'woocommerce_shop_loop_subcategory_title', 'woocommerce_template_loop_category_title' , has_action( 'woocommerce_shop_ loop_subcategory_title', 'woocommerce_template_loop_category_title' ) ). } );
Hide the number of products in a WooCommerce product category
If you don't want the category page to show Number of productsYou can use the following short code to hide:
add_filter( 'woocommerce_subcategory_count_html', function( $markup, $category ) {return null.}, 10, 2 );add_filter( 'woocommerce_subcategory_count_html', function( $markup, $category ) { return null. }, 10, 2 );add_filter( 'woocommerce_subcategory_count_html', function( $markup, $category ) { return null. }, 10, 2 );
Sort by Category WooCommerce Products
The following code snippet can be used Sort WooCommerce Products by Category::
add_filter( 'woocommerce_subcategory_count_html', function( $markup, $category ) {return null.}, 10, 2 );add_filter( 'woocommerce_subcategory_count_html', function( $markup, $category ) { return null. }, 10, 2 );add_filter( 'woocommerce_subcategory_count_html', function( $markup, $category ) { return null. }, 10, 2 );
How to Set WooCommerce Category Image Size
The following steps can be followed Resize WooCommerce Category Images::
- Go to the WordPress backendGo to Appearance > CustomizeThe
![Image [18] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224165451322-image.png)
- In the customization panelClick WooCommerce > Product ImagesThe
![Image [19] - WooCommerce Store Product Category Guide: How to Show, Hide and Optimize Product Categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224165455394-image.png)
- In the picture settingsSelection Default size maybe Click on "Customize" Set the image size manually.
![Image [20] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224165537558-image.png)
This makes it easy to adjust the WooCommerce Category Image Sizes, making it more compatible with the store layout.
WooCommerce Common Problems and Solutions for Displaying Product Categories
There are some common issues that users may encounter when displaying product categories in the WooCommerce store. Below are the solutions to these problems.
Issue 1: Product categories are not displayed in the menu
Sometimes, created product categories do not appear in the Website Menu Center.
prescription
- go into Appearance > Menu(Menus).
- Click on the upper right corner of the "Screen Options"(Screen Options).
- tick "Product Classification"(Product Categories) option.
![Image [21] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224165857836-image.png)
- In the left column, you can now see the product categories. Select the category you want to add to the menu and click on the "Add to menu"(Add to Menu).
![Image [22] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224165909652-image.png)
Issue 2: Category images are not displayed
Sometimes, WooCommerce category pages may not display category images.
prescription
- Ensure that each classification has been Setting up picturesThe
- go into Products > Classification(Products > Categories).
- Click on the category name below the "Edit."(Edit).
- Scroll down to "Thumbnail"(Thumbnail) section, click on the "Upload/add pictures"(Upload/Add Image).
![Image [23] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224170000156-image.png)
- Save Changesand then refresh the page to check if it takes effect.
Issue 3: Incorrect order of category display
Sometimes, WooCommerce categories may be displayed in the wrong order.
prescription
- go into Products > Classification(Products > Categories).
- expense or outlay Drag-and-Drop way (of life) Rearrange the order of categorizationThe
![Image [24] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224170031908-image.png)
Issue 4: Displaying empty product categories
By default, WooCommerce All categories will be displayed, including those without productsThe
prescription
If you want to hide the empty categories in the thematic functions.php
file Add the following code snippet:
add_filter( 'woocommerce_product_subcategories_args', 'hide_empty_categories' );function hide_empty_categories( $args ) {$args['hide_empty'] = 1;return $args;}add_filter( 'woocommerce_product_subcategories_args', 'hide_empty_categories' ); function hide_empty_categories( $args ) { $args['hide_empty'] = 1; return $args; }add_filter( 'woocommerce_product_subcategories_args', 'hide_empty_categories' ); function hide_empty_categories( $args ) { $args['hide_empty'] = 1; return $args; }
Problem 5: Category pages are not indexed by search engines
Sometimes, WooCommerce category pages Not indexed by search enginesthat affects SEO rankings.
prescription
- Check SEO plugin settings(e.g. Yoast SEO maybe Rank Math), make sure the category page is not set to "noindex"The
- go into Settings > Reading(Settings > Reading), make sure "Prevent search engines from indexing this site."(Discourage search engines from indexing this site)UncheckedThe
![Image [25] - WooCommerce Store Product Category Guide: How to show, hide and optimize product categories](https://www.361sale.com/wp-content/uploads/2025/02/20250224170749671-image.png)
summarize
Displaying product categories and subcategories in the WooCommerce store is essential for providing A clear and organized shopping experience Crucial. By categorizing products, it makes it easier for customers to find what they need.
Link to this article:https://www.361sale.com/en/34098
The article is copyrighted and must be reproduced with attribution.
No comments