Display WooCommerce category description and custom category titles

WooCommerce category description and custom title

David Nash woocommerce, wordpress 9 Comments

The WooCommerce category description is a good way to increase usability and improve SEO on your site. We can also show a custom category title which is a little more descriptive.

To do this, it’s good practise to start with something easy, get that working, and then build from there.

Show the WooCommerce category description

In the child theme, if it doesn’t already exist, create a woocommerce/ directory. Copy the template file from wp-content/plugins/woocommerce/templates/archive-product.php  to wp-content/themes/[your-child-theme]/woocommerce/archive-product.php. Now we can edit that without changing any plugin files directly (which could get replaced on the next update).

In WooCommerce 2.0.0+, towards the top of the file you should see this:

Below that code, add the following:

In wp-admin, go to Products > Categories and edit a category to make sure there is a description to display.

Save the archive-product.php file above and view your category. You should now see the description.

Display a custom title for WooCommerce product category pages

To do this we’ll use the excellent Advanced Custom Fields plugin. Install it if you haven’t already. Create a field group called “Product category title”. Add a field and call it “Category title”. The default is text, leave it as is.

Under “Location” change the rule to show this field group if Taxonomy Term is equal to product_cat and publish the field group:

Create a custom category title for WooCommerce

ACF field group display rule

In wp-admin, go back to Products > Category > [edit your category]. Now when you scroll down you should see your field. Enter your custom category name.

Then in your archive-product.php file, update the code you entered earlier to match this:

You might also need to comment out the existing <h1 class="page-title">   in that file, so you don’t end up with two titles.

That’s it! Just a few lines of code means you can now show your WooCommerce category description and a custom title.

Comments 9

  1. Hi David, I know this is a slightly older thread but I found it and is helpful to what I’m trying to do…

    Is there a way to modify the add ‘show category description’ so it only appears on the category pages and NOT the main shop page? I’m having a problem because there is a default description on the main shop page that says “This is where you can add new products to your store.” and I can’t figure out where that is coming from. I either need to take the description off of that page, or identify where the description is coming from so I can re-word it.

    Here is the staging site that I’m working on where you will see what I am dealing with –
    http://16e.117.myftpupload.com/catalog/

    Your help is much appreciated!

  2. Hi David

    I am having the same problem as Michele. I only want the category description to display on the category pages and not the shop page. I will be most grateful for any tips on how to resolve it.
    Great article by the way!

  3. I have the shop page set as the home page. It’s showing the categories the way I want, but I would like the descriptions to also display. I added this code and all that happened was that

    “product
    This is where you can add new products to your store.”

    appeared right about the text I had on the page. No descriptions are showing underneath the image and heading of the various categories.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.