Get a fast, conversion-focused WooCommerce theme in 2024. Switch to Shoptimizer.

Home Documentation Shoptimizer Code Snippets Create custom product category headings

Create custom product category headings

If you’d like to create custom <h1> headings for your product categories, you can achieve this with the Advanced Custom Fields plugin and a custom function. Let’s get started.

Firstly, you must set the category description layout to be ‘Within content‘. You can see if that’s the case via:

Appearance > Customize > Layout > WooCommerce - Category description layout

Next, use ACF to create a new field group. I’m calling mine Custom Product Category Title.

ACF - Custom category title

Under Rules, I’ve set it to show this field group if the Taxonomy is equal to Category (product_cat) – it’s important to ensure you’re selecting product categories and not post categories.

I’ve created a single text field called Product Category Title and the name is product_category_title. This name is important as I’ll be using this shortly within the code snippet.

Now, when I edit a product category, I’ll see my new field. Add some text to this.

Product category editor in WooCommerce

The final step is to replace the default product category title with our new, custom one.

To do this, I’ll need two functions.

  • The first will remove the default WooCommerce Product Category title
  • The second will hook our new custom field into this location

So, either within a child theme’s functions.php file, or via the Code Snippets plugin – add the following:

Now, when we look at the product category, we should see the custom title displayed.

Custom product category title displayed

The category name in this example is still Women, but the heading displays our custom title which is Stylish Women.

Note that you will need to add custom product titles to every product category, otherwise no heading will display.

To see more examples of using Advanced Custom Fields and WooCommerce, see our post on the topic.

$50
Off

Do you want a whopping $50 off Shoptimizer for WooCommerce?

Click the button below to get Shoptimizer for only $49. (Regular price: $99).
This is a special launch offer for today only.
Get it before it is gone!