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. You can show the extra fields on a normal WordPress page, on your shop or product category pages, or on the single product detail page. 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.
- WooCommerce product directory with a large product database. WooCommerce directory-style websites with large numbers of products often list extra product data within the directory listings view. For example, a book directory might include data for author, publisher and year.
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 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 to list 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. You can add product tables to any WordPress page, to your main WooCommerce shop or product category pages, or even to the single product page.
You need the WooCommerce Product Table plugin to display your custom fields and taxonomies. It supports all 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 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 with all the extra data.
Install WooCommerce Product Table
- 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. You can also choose some default settings which will be used for all your product tables. This saves having to create such complex shortcodes later on, as these settings will be used automatically whenever you create a product table.
Now, the product table plugin is set up. The next step is to add product tables to your website. Use one of the following methods, depending on whether you want to display WooCommerce custom fields and taxonomies.
How to show WooCommerce custom fields and taxonomies on a standard WordPress page
- Install WooCommerce Product Table.
- Go to edit any page in WordPress. This is where you’ll add a table listing some or all of your products with the 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.
How to display custom fields and taxonomies on the WooCommerce shop page or product category archive
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 directly to the main WooCommerce shop page or category pages. This is a bit trickier, as you need to add the product table shortcode to the template file in your theme. The plugin knowledge base provides instructions on how to do this.
- Install WooCommerce Product Table.
- Follow the instructions for adding product tables to the shop or category archive template.
How to show custom fields and taxonomies on the single product page in WooCommerce
- Install WooCommerce Product Table.
- Go to edit the product where you want to display custom fields and taxonomies.
- Add a product table shortcode to the Short Description field.
You can use this shortcode as a starting point.
[product_table columns="cf:size,tax:fabric,stock" page_length="false" search_box="false" reset_button="false" totals="false" include="19" links="none"]
This lists the data for the current product. There are columns for a custom field called ‘size’, a custom taxonomy called ‘fabric’, and a stock column. I have hidden elements such as the search box, which aren’t needed on the single product page.
Replace the sections of the shortcode in red as follows:
- cf:size – Replace ‘size’ with the name of the custom field you want to display in the table. (More information here.)
- tax:fabric – Replace ‘fabric’ with the name of the custom taxonomy you want to display on the product detail page. (More information here.)
- include=”19″ – Replace the number 19 with the ID of the product that you want to show the data for. You can find this by going to the ‘Edit Product’ screen in WooCommerce. Look at the URL at the top of your browser window. For example, my example product has the URL /wp-admin/post.php?post=19&action=edit. This tells me that the ID is 19. Do the same and find the ID for your product.
- You can also make any other changes to the product table, for example by adding or removing columns. See the full list of options in the knowledge base.
Now save the product and view it. You will see a simple WooCommerce table in the short description field, containing the custom fields and taxonomies.
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.
Continue customizing 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.
You can set up your product tables in a way that will get more sales with our top 10 tips for WooCommerce conversion rate optimisation.
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 30% commission for recommending it on your website!