Display WooCommerce category description and custom category titles

WooCommerce category description and custom title

David Nash woocommerce, wordpress 28 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:

<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>

	<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>

<?php endif; ?>

Below that code, add the following:

//show category description
$term_object = get_queried_object();
<div class="woocommerce-category-description">
    <div class="title"><?php echo $term_object->name; ?></div>
    <div class="description"><?php echo $term_object->description; ?></div>

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:

//show custom title and category description
$term_object = get_queried_object();
<div class="woocommerce-category-description">
    <div class="title"><?php echo the_field('category_title', 'product_cat_'.$term_object->term_id); ?></div>
    <div class="description"><?php echo $term_object->description; ?></div>

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 28

  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 –

    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

    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.

    1. Hi Shumaher – that’s correct, this tutorial only covers a custom description for the category.

      If you’d like to add another field for an additional description, you could add that below your category title in AFC, and then just copy and paste the code that outputs the ACF field – just make sure you update the field name to match your new field.

  4. Hi David, thank you for this tip! I’ve successfully added a custom product category title with your help. Is it possible to adjust the styling of the custom title text? Mine appears as body sized text, rather than title sized text.

  5. If you cant get rid of the text “This is where you can add new products to your store” use this code:

    //show category description
    $term_object = get_queried_object();
    if($term_object->description == "This is where you can add new products to your store."){


  6. Hi All, is there any way to display the meta description on these pages as well for SEO purses?

    As far as i know the only way to do that is to go with the pro version, seems allot to pay for just getting meta description tags, if that’s all you want…


    1. Post
  7. Thanks you so much, I was trying to display my category text for days and you solve my problem within 30min, everything is working.
    Antoine from france

Leave a Reply