WooCommerce: Hide SubCategory Products On Product Category Pages

You’d think that this was a core WooCommerce setting – it’s not.

In fact, from the WordPress “Customizer“, you can set the product category page display to “Show products” only, “Show subcategories” only, or “Show subcategories and products” (see screenshot below). But these 3 options, in my opinion, could and should do much better.

For example, if you assign a product “ABC” to a parent category “X“, and a product “DEF” to a child category “X->Y“, and if you choose “Show products“, the parent category page will show both “ABC” and “DEF” products, while there should only be 1.

If you select “Show subcategories“, the same page will only have the link to the subcategory, but the product belonging to the parent category, “ABC“, won’t be visible, which doesn’t make sense.

If, even worse, you pick “Show subcategories and products“, the parent category page will display the subcategory link, as well as both productsABC” and “DEF“, which once again is a bit weird.

Let’s fix this with a simple snippet – enjoy!

Continue reading WooCommerce: Hide SubCategory Products On Product Category Pages

WooCommerce: Redirect Product Category Pages

Maybe because you have only one product category and therefore search engines would find duplicate content (Shop page = Category page) and penalize your website.

Or maybe because you use advanced product filters and you prefer customers to see the filtered view “by category” (e.g. “example.com/shop/?_product_category=tables“) as opposed to the default category pages ( “example.com/product_category/tables” ).

Either way, it is possible to programmatically redirect all product category pages to a given page or to a relevant URL with parameters – and here’s the fix. Enjoy!

Continue reading WooCommerce: Redirect Product Category Pages

WooCommerce: Delete “Uncategorized” Product Category Forever

Upon installation, WooCommerce adds a default product category called “Uncategorized”. This is a nice feature because each product must belong to at least one category, and “Uncategorized” is therefore the WooCommerce-way to avoid problems.

All good so far, until you get to the stage where you have dozens of product categories and if *one day* (everyday for me lol) you forget to assign a product to one of them your product will automatically fall under “Uncategorized”, with that category showing also on the frontend which is not nice at all.

In this post, we’ll see how to remove this “Uncategorized” category, forever. Enjoy!

Continue reading WooCommerce: Delete “Uncategorized” Product Category Forever

WooCommerce: Hide Category Images @ Shop

If your Appearance > Customize > WooCommerce > Product Catalog > Shop page display is set to “Show categories and products“, parent product categories will show in the “products loop” as the very first elements (see screenshot below). They really take up a lot of space and this could be annoying at times, mostly when you don’t use product category images.

Thankfully, if this makes sense to you and your customers, you can remove them easily (it’s one line of code). Also, this works really well when the number of parent product categories is proportional to the number of shop display columns (e.g. you have 6 parent categories and you have 3 products per row under Appearance > Customize > WooCommerce > Product Catalog > Shop page > “Products per row”). Enjoy!

Continue reading WooCommerce: Hide Category Images @ Shop

WooCommerce: Product Category Filter @ Shop Page

There is already a widget that allows you to place a “Product Category Dropdown” in your sidebar areas. The problem is that lately, sidebars have become kinda 1990. So, what if you want to place a “Category Select Box” anywhere in your WooCommerce website, and (in this case study), exactly on the Product Category pages, so that you can switch from one category to the other?

Well, in this snippet you will learn a lot of things. For example, the wc_product_dropdown_categories() function magically displays a category dropdown, while the wc_enqueue_js() function allows you to inject jQuery (responsible to trigger the category page redirect).

Continue reading WooCommerce: Product Category Filter @ Shop Page

WooCommerce: Add Second Description @ Product Category Pages

In terms of SEO, if you’re trying to rank your product category pages, you really need to make the most of the default WooCommerce product category “description” and “thumbnail”. Most themes, if compatible with WooCommerce, will show this content right below the product category name and above products.

Nothing new so far. But what if you want to add another piece of content below the category products while also keeping the default description? Well, we’d need to customize the edit category page and display a new text editor field, save it, and finally display it where we want. So, here’s how they do it!

Continue reading WooCommerce: Add Second Description @ Product Category Pages

WooCommerce: Hide “No products were found matching your selection”

When your WooCommerce store has no published products the shop page will not display anything. A message “No products were found matching your selection” will show instead. The same applies to empty categories or when you decide to completely hide the shop page products for some reason, especially for custom built layouts.

So, how do we hide this notice? Thankfully, and once again, one line of PHP is sufficient to achieve the result! Enjoy 🙂

Continue reading WooCommerce: Hide “No products were found matching your selection”

WooCommerce: Change Product Permalinks @ Shop / Loop Pages

A BloomerArmada fan asked me a very interesting question: how can I link each product in the shop page to its own custom landing page as opposed to the default permalink?

Of course this applies when you don’t want to use the default single product page for all or some products. Clearly, you could set up a 301 redirect from the single product page to the landing page – that will help for SEO as well. But if this is temporary, or you need to still give access to the single product page later on, then a redirect is no good.

So, here’s how you can override the default permalink.

Continue reading WooCommerce: Change Product Permalinks @ Shop / Loop Pages

WooCommerce: Detect if Current Category is a Subcategory

A client of mine had to style a WooCommerce product category page but ONLY if it was a subcategory. So I decided to add a “subcategory” class to the HTML body, so that they could target this in their custom CSS.

As usual, the PHP is quite easy: I check if the current page is a product category, then if the category has “parents” – and only in this case – add a body class. Pretty easy!

Continue reading WooCommerce: Detect if Current Category is a Subcategory

WooCommerce: How Top Brands Design Product Category Pages

eCommerce Category Description

Selling on the web is a highly competitive game. There is no shortage of both customers and competitors. Big companies crush little companies every day. But that doesn’t mean smaller websites doesn’t have any chance.

Smaller companies can beat larger companies if they focus on the right things. For that, you always need to look for opportunities and act smart when it comes to promoting your brand and products.

Leveraging search engines is one of the cheapest ways to bring customers to your website. For that, you need to make sure you are fulfilling the search query. Since Google is always looking for the best fit & best experience for users based on their query.

Category pages or product listing pages are key hub pages in any E-commerce store. Products tend to come and go but categories stay. So it’s better to build up your category pages.

For example, if you are selling necklaces, you have more than one necklace for sure. So rather than 5 necklace pages competing for the same Necklace terms, optimize the category page for necklaces while optimizing the products for specific necklace style (e.g. Crystal Necklaces). Your primary focus should be ranking your category pages for specific key terms.

Most online stores neglect their category pages and organize them in a way that it does more harm than good. If optimized correctly they can bring in good traffic for top level keywords and reap the rewards for months.

Continue reading WooCommerce: How Top Brands Design Product Category Pages

WooCommerce: How To Display Categories on Any Page

Bellini WooCommerce Product Categories

Categorizing products is a great a way to de-clutter your WooCommerce shop and intuitively guide users to the page they are looking for. In WooCommerce you can easily group your similar products under a category, making it easy for users to scan and find the products.

For Example, if you sell T-shirts, Shirts, Pants, and Sunglasses you can easily categorize T-shirts, Shirts, and Pants under “Clothing” category and Sunglasses under “Accessories”.

In WooCommerce shop or archive pages you can display only products, only categories or both products and categories together. In this article we will see how to create WooCommerce categories and display them on shop or archive pages.

Continue reading WooCommerce: How To Display Categories on Any Page

WooCommerce: Display Different Widgets Based On Product Category

Using Widget Logic, you can easily set what widget you want to display based on what WooCommerce product categories users are browsing.

For example, you can set what widgets users will see when he will land to the “Book” product category page. These widgets will not be visible in other pages, it will be only shown to a user when he lands to that exact category.

Continue reading WooCommerce: Display Different Widgets Based On Product Category

WooCommerce: Show Category For Each Product @ Shop Page

A client of mine has a category called “Brand”. Each product is assigned to a specific Brand subcategory e.g. Nike, Adidas, etc. The goal of this task was to show the “Brand” subcategories in the shop/category/loop pages as a way to help the user identify the brand name.

The same can be applied to showing ALL categories, so the user knows exactly to what section of the shop the product belong to. Great, let’s see how it’s done!

Continue reading WooCommerce: Show Category For Each Product @ Shop Page

WooCommerce: Hide Categories From Product Cat Widget

A client asked me to customize the Product Categories Widget that comes included with WooCommerce. In this case, they wanted to show ALL categories but the current one (when looking at a category page of course).

You can also use this tutorial to hide certain category IDs from the widget, or maybe “all product category names that start with a given string of text”. Case studies are millions, but the code base is always the same – we’ll make use of the “woocommerce_product_categories_widget_args” filter and provide a list of product categories to exclude. Enjoy!

Continue reading WooCommerce: Hide Categories From Product Cat Widget