How to add additional fields to WooCommerce category

Why do you need to add additional fields to WooCommerce categories

Every once in a while the built in fields won’t be enough and you’ll have to add your own in order to adjust a website for your needs. In my particular case I needed to add additional description for after the main content in a category page and this is how I accomplished that

  1. Figure out which hooks you need to add your actions too
  2. Add your fields
  3. Add the “Save” action
  4. Use our new field

Figure out which hooks you need to add your actions too

After some research I came accross the “{taxonomy}_add_form_fields” and “{taxonomy}_edit_form_fields” in the WordPress developer resources. Digging a little more I figured out that the categories taxonomy is called “product_cat”. Now that we know where to add our fields, we need to figure out how to save the data. A little digging later I found “edited_{taxonomy}” and “create_{taxonomy}”. Now lets code!

Add your fields

Add your field to the “Add category” screen

Now when we’ve done the initial research, adding the fields is simply a matter of outputting the HTML

Add your field to the “Edit category” screen

Adding the field to the “Edit” screen is sort of similar to the “Add” screen but we have to retrieve the initial value first, because there might already be a saved value.

Add the “Save” action

Now we need to handle the saving of our data from the both “Add” and “Edit” screens:

Use our new field

Now in my case I wanted to add the text from the field just below the main content in the category page, and the hook ‘woocommerce_after_main_content’ was exactly what I needed

And voila this is my thought process behind adding additional fields to custom taxonomies and more precisely product_cat in WooCommerce
You can download the code for this how-to in

About Pavel Petrov 2 Articles |  17 How-tos
Pavel is a senior developer for the last 7 years, with extended interest in Linux administration, WordPress and Symfony.