WooCommerce: Override Product Category Page Title

This is an interesting WooCommerce customization – as you know WordPress menus and widgets read whatever product category name and display it in the frontend.

Let’s say your product category title is “Tables”. This will show up in the navigation menu if you have set it up that way, in te breadcrumbs if you have any, in the sidebar category widgets, and as a title on the single product category page.

This is great and all, but what if your product category name is “Red Round Tables By Whatever Brandname“? As you can imagine, displaying this in a sidebar or navigation menu may be a little too much, while it’s fine to use it as a H1 on the single product category page for SEO reasons and enhanced readability.

So, the question is – how do we define an “alternative” product category name, so that this can be used on the product category page as custom title, while using the default one for other smaller locations such as menus and widgets?

Well, this is how it’s done – enjoy!

Continue reading WooCommerce: Override Product Category Page Title

WooCommerce: Conditionally Hide Widgets

You could use a popular plugin called Widget Logic, or instead you could keep it simple with a few lines of PHP. Here’s a snippet for you in case you need to conditionally hide a certain sidebar widget given a condition e.g. if you’re on the Cart page.

Of course, you can use any of the available WooCommerce conditional tags and make this more complex, but in this example we’ll keep it simple and check if we’re looking at the Cart page (thanks to the is_cart() conditional). Enjoy!

Continue reading WooCommerce: Conditionally Hide Widgets

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: 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