Display Extra WooCommerce Product Data with Custom Fields & Taxonomies
WooCommerce comes with various fields for storing product data. There’s the product name, long and short description, price, images, stock, weight, dimensions etc. But what happens if you want to store and display extra product data, such as WooCommerce custom fields and taxonomies?
I’m going to tell you how to create WooCommerce custom fields and custom taxonomies for products. We’ll look at the difference between them and which to use for different types of product data. I’ll also show you how to add custom fields and taxonomies to store extra information about WooCommerce products.
Finally, I’ll teach you an easy way to display products with the extra custom fields and taxonomies in a searchable, sortable table. All without writing a single line of code!
Display products with custom fields & taxonomies using the WooCommerce Product Table plugin.
What’s the difference between WooCommerce custom fields and taxonomies?
WooCommerce custom fields are used to store arbitrary, one-off information about a product. A custom taxonomy is for grouping things together.
This is reflected in the way you add custom fields and taxonomies for products in the WordPress admin:
- Custom fields appear in the main column of the Add/Edit Product screen. This is where you add other unique product data such as title, description, price etc.
- In contrast, custom taxonomies appear in the right hand column under the product categories and tags. Like categories and tags, each WooCommerce taxonomy term should be selected for multiple products.
When should I use custom fields & when should I use a WooCommerce taxonomy?
Once you understand the difference between a WooCommerce custom field and taxonomy, it becomes more obvious when to use each one.
As a rule of thumb, you can decide between custom fields and taxonomies by asking yourself: “Is the data I am adding unique to each product, or does it apply to multiple products?” If the data is unique for each WooCommerce product then you need a custom field. If you want to select the same value for several products and use it to group them together (e.g. via a product filter) then you need a WooCommerce taxonomy.
Here are some examples to help you choose:
- WooCommerce clothes store displaying the colour of each product. If you’re selling clothes in WooCommerce, you’ll probably want customers to be able to find products by colour. You’ll have multiple products of each colour. By creating a WooCommerce custom taxonomy called ‘Colour’, customers can filter the list of products to find the colour they like. This wouldn’t be possible with a custom field.
- WooCommerce second hand site storing ‘condition’ information about their used products. If you’re selling used goods like eBay, you’ll need a field to store details of any damage etc. The description of each item’s condition will be unique to that product, so you should create a WooCommerce custom field.
And if you’re feeling really clever, you can use both together!
To use the 2nd example above, a store selling used goods might want a WooCommerce taxonomy called ‘Condition’ AND a custom field called ‘Condition Description’. The ‘Condition’ taxonomy would include the terms “New”, “As New” and “Used”, which apply to multiple products. You could create product filters so that customers can narrow down their search based on the overall condition. The ‘Condition Description’ custom field would provide unique information about the exact condition of the product and any damage.
Video tutorial – WooCommerce custom fields & taxonomies
In this video tutorial, you can watch me creating WooCommerce custom fields and taxonomies and displaying them on a website. There are also full written instructions below:
How to create WooCommerce custom fields
There’s no dedicated WooCommerce custom fields plugin. Instead, you can create custom taxonomies for WooCommerce products using the free Advanced Custom Fields WordPress plugin. With over 1 million active users, this is the most popular WordPress custom fields plugin.
These instructions assume that you have already set up WooCommerce and just need to store and display extra product fields:
- In the WordPress admin, go to Plugins > Add New and search for ‘Advanced Custom Fields’. Install and activate the plugin.
- Click the ‘Custom Fields’ link in the left of the WordPress dashboard.
- Click ‘Add New’ next to the ‘Field Group’ heading.
- On the ‘Add New Field Group’ screen:
- Add a name for the Field Group. This is just for internal purposes and your customers won’t see it.
- Location – Set it up to Show this field group if Post Type is equal to Product.
- Now scroll back up a bit and click the blue ‘Add Field’ button.
- Add a descriptive Label for the custom field. Customers won’t see this.
- Add a Name for the WooCommerce custom field (1 word, lowercase). You’ll need this when you display the data in a product table, later.
- Choose the Field Type. There are many types of custom field. (You might notice a field called ‘Taxonomy’. This doesn’t actually let you create a custom WooCommerce taxonomy, so ignore this option and use the instructions in the next section.)
- Add any further information for your custom field or taxonomy, then click ‘Publish’.
- Finally, you can start using the custom field to store extra data about your products. Go to the ‘Edit’ screen for each product (or the ‘Add Product’ screen if you don’t have any yet). You’ll see your WooCommerce custom fields as you scroll down the page. Enter the custom field data there.
How to create a WooCommerce custom taxonomy
The best plugin to create a custom taxonomy for WooCommerce products is Custom Post Type UI. With over 400,000 active users, it’s a hugely popular plugin and is 100% free too!
As well as creating custom post types (which you don’t need to do), it lets you add taxonomies to an existing custom post type. This is what you need, as WooCommerce products are a custom post type in WordPress.
Here’s how to use Custom Post Type UI as a WooCommerce custom taxonomy plugin:
- Go to Plugins > Add New in the WordPress admin and search for ‘Custom Post Type UI’.
- Install and activate the plugin.
- Go to the ‘CPT UI’ section in the left of the WordPress admin and click on the ‘Add/Edit Taxonomies’ section:
- Add the Taxonomy Slug (ideally 1 word, lowercase).
- Add a plural and singular name (label) for your WooCommerce custom taxonomy. This will only appear in the WordPress admin.
- Attach it to the Products post type.
- Click ‘Add Taxonomy’.
- Now go to the Edit Product page and you’ll see the custom taxonomy on the right hand side, under the categories and tags. Add 1 or more taxonomy terms for each product, just like with standard product tags.
Displaying WooCommerce custom fields & taxonomies
Now we get to the tricky bit. Normally, the only way to display custom taxonomy terms and custom fields is to edit the template files for your single product and product archive pages. This involves a bit of coding knowledge.
It wouldn’t be responsible for me to provide instructions on how to display custom fields and taxonomies programmatically. This is because you need wider knowledge of how to override WooCommerce templates etc. and I don’t agree with providing code snippets out of context. If you want to go down this route and don’t know how to do it, I recommend asking your WordPress developer. If you don’t have one, post a job on Codeable and their pre-approved WordPress experts will give you a good price.
Instead, I will tell you about a plugin that lets you show products in table along with data such as WooCommerce custom fields and taxonomies. It’s an ideal way to display products with extra information as everything is presented in a structured tabular format. Use it as an alternative to displaying extra product data on WooCommerce category archive pages.
You can do this using the WooCommerce Product Table plugin. It can show any of the usual WooCommerce product data, plus custom fields and custom taxonomies. Each item of product data is listed as a separate column in the table. Customers can search or sort the table by custom field or taxonomy. They can also filter by taxonomy via handy dropdown lists above the table. You can even create WooCommerce product tables that only contain products with a specific taxonomy term or custom field value.
This is much easier than modifying your WooCommerce template files, and you get all the other benefits from using product tables.
How to create a product table with WooCommerce custom taxonomies & custom fields
It’s easy to set up WooCommerce Product Table to show your products in an interactive table with all the extra data you need:
- Get WooCommerce Product Table. Download the plugin using the link on the order confirmation page and email.
- In the WordPress admin, go to Plugins > Add New. Upload the plugin files and install and activate the plugin.
- Go to the plugin settings page: WooCommerce > Settings > Products > Product Table. Enter your license key and click Save.
- Now create a new page. Alternatively, go to the page where you want to add a product table with your WooCommerce custom fields and taxonomies.
- Enter the shortcode:
This will display all your products in a table with standard data. Next, you need to expand the WooCommerce Product Table shortcode to include all the data you want to list in the product table. Each piece of product data will be a separate column in the table.
There are full instructions for all the available columns in the plugin knowledge base. To get you started, here’s an example of a product table with columns for name, a custom field called ‘Condition’, a custom taxonomy called ‘Colour’, price and add to cart button. You need to know the custom field name and the taxonomy slug. You chose these when you created your custom fields and taxonomies earlier in this tutorial.
Display WooCommerce taxonomies in a filter
You can also list your custom taxonomies as a filter dropdown above the product table.
You can add a separate filter for each custom taxonomy (plus other data such as attributes, variations, categories and tags – instructions here).
This is how to add 1 filter with the ‘colour’ taxonomy:
[product_table columns="name,cf:condition,tax:colour,price,add-to-cart" filters="tax:colour"]
Create tables listing products with a specific taxonomy term or custom field
By default, your WooCommerce product tables will list all your products in a table. This is perfect if you plan to have a single table listing your entire WooCommerce inventory.
You can also create product tables listing products from a specific category, tag, custom field or custom taxonomy term. There are full instructions in the knowledge base. Here are some quick examples to get you started. Again, you will need the custom field name or custom taxonomy slug AND individual term slug.
How to list WooCommerce products with a specific custom field value
In this example, we have a custom field with the name ‘condition’ and a custom field value of ‘new’:
[product_table columns="name,cf:condition,price,add-to-cart" cf="condition:new"]
How to list WooCommerce products with a specific custom taxonomy term
In this example, we’re using a custom taxonomy with the slug ‘colour’ and a term with the slug ‘red’. We need to include both in the product table shortcode:
[product_table columns="name,tax:colour,price,add-to-cart" term="colour:red]
You can list WooCommerce products with multiple custom taxonomy terms or custom fields. See the documentation for full details of what’s possible.
Automatically display the extra product data on WooCommerce category archives or Shop page
Most people add WooCommerce Product Table to normal WordPress pages. They include these pages in their website navigation structure instead of linking to the built-in WooCommerce category archives.
If you prefer, you can add product tables with the extra custom fields and taxonomies to the actual WooCommerce templates. The plugin knowledge base provides basic instructions on how to add them to product category pages and the main WooCommerce Shop page.
Continue customising your product tables
The WooCommerce Product Table knowledge base contains full details of all the options for configuring your product lists. It’s a very sophisticated plugin and this tutorial has barely touched the surface of what’s possible.
Have a read through the knowledge base and plan the perfect product table to display your WooCommerce custom fields and taxonomies. If you like the plugin, sign up as an affiliate and get 13% commission for recommending it on your website!