WooCommerce Custom Fields: How to Create & Display

By Updated: October 10, 2019 15

WooCommerce custom product fields plugin

This is the complete guide on how to create WooCommerce custom fields. You’ll learn how to show extra product data and sell extra product options on your website.

WooCommerce comes with lots of ways to store product data. There are all the standard product fields such as the name, price, categories, tags, and dimensions. There’s also the option to create product attributes.

But what if you want to store extra product fields? What if you want something more flexible than product variations, such as checkboxes or text fields? Well, that’s where WooCommerce custom fields come in.

2 types of WooCommerce custom fields

When people talk about WooCommerce custom fields, they typically mean one of two things:

  1. Adding extra information about the product This is the classic use of custom fields. In WordPress, custom fields are used to add additional fields to posts, pages or products. You use these to store and display extra information, such as extra text fields, dates, images, and more.
  2. Selling extra product options, as an alternative to using variations This involves adding extra fields containing dropdown lists, checkboxes, radio buttons, text fields etc. for the customer to complete before adding the product to their cart. Technically, extra product options are’t custom fields at all – they’re better known as product add-ons! However, a lot of people refer to these options as custom fields.

Keep reading to learn how to add both types of custom fields to your WooCommerce products. You’ll discover how to display them in a table layout in your store, making it easy for customers to see the custom fields and (if you’re using add-ons) add them to the cart.

Using WooCommerce custom fields to store extra product information

By adding custom fields to a WooCommerce product, you can add extra data and show it on your website. A lot of people do this programmatically, but this is a guide for non-developers.

I’ll show you how to add custom fields to WooCommerce products – and show them in the front end of your website – without writing a single line of code. You’ll learn how to show extra product fields anywhere you like, including on the single product page, shop and category pages.

After creating our product custom fields, we’ll display them in the front end using a choice of two plugins. In particular, WooCommerce Product Table makes it easy to display custom fields created by any plugin in a table, anywhere on your site. You can either list multiple products and their custom fields, list products with a specific custom field value only, or add a table of custom fields to the single product page. We’ll also look at a simple plugin that displays a custom field above the add to cart button.

WooCommerce product table custom field columns
WooCommerce Product Table plugin displaying custom fields in the front end
WooCommerce Product Table
Start showing extra product data on your WooCommerce store today!

First, I’ll share a real-life case study about a company which uses WooCommerce custom fields to provide extra information about their products. Afterwards, I’ll provide full instructions on how to create your own Woo custom fields and display them on your product listings.

Case study – How Wavelength Electronics use custom fields in their WooCommerce store

Wavelength Electronics sell technical products in the electronics industry. As with most technical products, customers need to check a lot of information before making their purchase. With all the extra product data to display, Wavelength Electronics used our WooCommerce Product Table to create WooCommerce custom fields to help their clients quickly find what they’re looking for.

The product table now displays a datasheet column with a PDF icon for each item, so customers can open up the datasheet straight from the product table. There’s also a column with ticks so show which models include a temperature controller.

Read on to find out how to add your own WooCommerce custom fields to your WooCommerce website.

In this section…

See WooCommerce custom fields in action on our custom fields demo page.

WooCommerce custom fields or taxonomies?

I’ll start by explaining the difference between 2 type of WooCommerce product extra fields: custom fields and taxonomies. Understanding this will help you decide which one to use.

Difference between WooCommerce custom fields and taxonomies
Custom field for 'Condition', custom taxonomy for 'Colours'.

What are WooCommerce custom fields?

Custom fields add extra fields to the Add/Edit Product screen in WooCommerce. They’re ideal for storing standalone data about products. Here are some examples of when you should use WooCommerce custom fields:

  • To store a unique product barcode, inventory or reference number.
  • For adding extra ways for people to interact with your products. This might be by adding extra buttons (e.g. ‘Enquire about this product), icons or social sharing links.
  • To display multimedia content about the product, such as embedded video or audio tracks.
  • For adding shortcodes provided by other plugins, such as a WooCommerce Add to Quote or Wishlist plugins.
  • To store additional notes about the prices or alternate price options. For example, if you’re using a bulk discount WooCommerce plugin and want to list the quantity-based discounts, then you can add this information to a custom field.

The idea of a custom field is that it stores unique information. Since the data stored in the field is unique, you can display it in the WooCommerce front end – e.g. on the product detail page, shop or category pages. However, you wouldn’t expect to use this data to group or filter products. If you want to filter by that type of data, then you need a custom taxonomy instead.

You can create WooCommerce custom fields using any custom fields plugin. Once you’ve created the custom fields, it’s easy to show them on your website using the WooCommerce Product Table plugin. Keep reading for full step-by-step instructions on how to do all this. First, I’ll quickly tell you about WooCommerce custom taxonomies so that you can be sure you’re choosing the most appropriate field type for your data.

What are custom taxonomies in WooCommerce?

Like WooCommerce custom fields, taxonomies are a way to store and show extra product data. However, the difference is that they are designed to store re-usable information which can be used to group and filter products. For example, you can create a dedicated archive page listing all products that share a specific custom taxonomy term. You can also use taxonomies to filter products using the WooCommerce Product Table plugin.

Custom taxonomies are very similar to WooCommerce product categories. In fact, WooCommerce categories are actually set up as a taxonomy under the hood. When you create a custom taxonomy in WooCommerce, it adds tick boxes/check boxes to the right hand side of the Add/Edit Product screen – just like categories.

Here are some examples of when you might use WooCommerce custom taxonomies:

  • A WooCommerce bookstore needs to store extra product data such as year of publication, author, and publisher. Since more than one book has the same year, author or publisher, customers need to be able to sort and filter by this data. You can do this using WooCommerce custom taxonomies.
  • If your products relate to a specific geographical area, then you can use custom taxonomies to group products by area. For example, you could create a custom taxonomy called ‘Area’ and add a separate taxonomy term for each state or county. Customers can then filter by area, or view lists of products from a specific area only.
  • A WooCommerce clothes store can use custom taxonomies to store extra data such as brand name. Customers can then search and filter to find products with their favourite brands, as this field isn’t built into WooCommerce as standard.
In summary, use custom fields for unique one-off data, and taxonomies if you want to use the data for filtering or other types of grouping.

Read our tutorial about how to create WooCommerce custom taxonomies.

Method 1 – How to create WooCommerce custom fields in the back end

Ok, now you know when to use custom fields. Next, I’ll show you how to create extra WooCommerce product fields. It’s surprisingly easy!

First, here’s a video tutorial about how to create and display WooCommerce custom fields and taxonomies. Below, you’ll find full written instructions.

Which WooCommerce custom field plugin?

First, you’ll need a custom fields plugin. There are plenty of good free plugins for creating custom fields in WooCommerce, including Advanced Custom Fields and Toolset. You can also use a dedicated WooCommerce custom fields plugin if you prefer.

I’m going to use Advanced Custom Fields in this tutorial, as it’s the most popular. The instructions are the same for most custom field plugins. If the custom fields don’t show up on your site when you follow the later sections of this tutorial, make sure the plugin isn’t adding extra characters to the start of the custom field name. (You might need to contact their plugin support to ask about this) For example, Toolset Types automatically adds adds wpcf- to the start of the custom field name, so you need to know this.

How to create WooCommerce custom fields with the Advanced Custom Fields plugin

  1. Log into WordPress and find Plugins > Add New. Search for ‘Advanced Custom Fields’, then install and activate this free plugin.
  2. Click ‘Custom Fields’ on the left hand side of the WordPress dashboard.
  3. Click the ‘Add New’ link by the ‘Field Group’ at the top of the page.
  4. How to create WooCommerce custom fields
    Next, you’ll see the ‘Add New Field Group’ page:
    1. First, add a name for the group of custom fields you’re creating. (No one else will see this.)
    2. Location – Choose Show this field group if Post Type is equal to Product. This tells Advanced Custom Fields to show the custom field on the Add/Edit WooCommerce product screen.
    3. Press the blue ‘Add Field’ button. Now it’s time to create the individual custom fields where you’ll store the extra product data.
    4. Add a Label for the custom field. This is how the custom field will be labelled on the Add/Edit Product screen.
    5. Choose a Name for the custom field (this should be 1 word in lowercase).You’ll need this to display the WooCommerce custom field on the front end of your website, later.
    6. Choose a Field Type from the available types of custom field. You can choose text, textarea, numbers, checkbox, radio button, etc.
    7. Complete any extra fields for the custom field such as adding a default placeholder value. Finally, click the blue ‘Publish’ button.

That’s how to create WooCommerce fields. The next step is to add data to the custom field value for some or all of your products. To do this, go to the ‘Edit’ page for each product and you’ll see the extra WooCommerce custom field(s) lower down the page. They’ll be shown somewhere below the Product Data section. Edit the placeholder, enter values into the custom fields, and then save the product.

How to show WooCommerce custom fields on any page

Show WooCommerce custom fields

So far, you’ve learned how to store WooCommerce product extra fields in the back end of your WordPress website. That’s fine if you’re just storing extra notes for internal purposes. But what if you want to show WooCommerce custom fields on the front end of your website? We’ll get to this now!

The easiest way to show your extra product data is to list products in a table on a normal WordPress page. Our WooCommerce table plugin can include as many columns of information about each product as you like. The great thing is that you can include WooCommerce custom fields in the table. This is more flexible than the default store layout, which just lists basic information such as the product name and price. It’s a really easy way to display the extra product data.

Get WooCommerce Product Table

How to do it

  1. Get WooCommerce Product Table and install and activate the plugin.
  2. Add your license key on the plugin settings page: WooCommerce > Settings > Products > Product Table. You’ll also see various options for your product tables. Go through them and choose whichever options you like. You can set your columns here including the WooCommerce custom field columns. However, I’ll show you how to do it directly for each table in Step 4 as it’s more flexible. You can also control how variable products work.
  3. Now, go to Edit any page on your WordPress site. Use the [product_table] shortcode to list all your products, either with the default columns or the columns you set on the settings page. Feel free to view the page and see what it looks like!
  4. Next, go back to the product table shortcode. It’s time to choose your columns and show the WooCommerce custom fields in the table. To do this, you need to add columns="" to the shortcode (or you can choose columns globally on the plugin settings page). Between the quotation marks, you need to list the columns to include in the table. The knowledge base contains the full list of available columns. To add a custom field column, you need to add cf: followed by the custom field name that you created earlier.

For example, the following shortcode will list all your products with columns for name, description, a custom field called ‘custom-field’, plus price and add to cart:

[product_table columns="image,name,cf:custom-field,reviews,price,add-to-cart" shortcodes="true"]

This is what is looks like in the back end:

WooCommerce custom field add to page

And here’s a screenshot of the front end:

Show WooCommerce custom fields

You can see how variable products work by looking at the “Ship Your Idea” product.

Tip: You only need to add shortcodes="true" to the above shortcodes if you have added HTML content or other shortcodes to your custom field. I did this because I had added a button and embedded audio player to my WooCommerce custom fields. 

Make changes to how your custom fields are displayed

So far, I’ve shared a simple method to show WooCommerce custom fields in the front end of your website. Now, let’s get more advanced and configure how our custom fields are displayed.

WooCommerce Product Table is a very flexible plugin. Choosing your columns is just one of over 50 options! Look at them all and configure your table to show whatever product data you need.

For example, you can:

  • Create product tables listing products from a specific category, tag or custom field only. (More on this below.)
  • Add filter dropdown lists above the table, or filter widgets in the sidebar. (But remember, you can’t filter by custom field because custom fields aren’t designed for grouping products. You need to use categories, attributes, tags or custom taxonomies to store filterable data.)
  • Use the lazy load option to speed up the table if you have too many products to load all at once.
  • And much more…

Have a play, and get your product tables and WooCommerce custom fields showing exactly as you need them.

How to dislay WooCommerce custom fields and taxonomies

Show custom fields on the WooCommerce shop or product category pages

As you saw earlier, the easiest way to display WooCommerce custom fields is to add a product table to a standard WordPress page (or multiple pages). You can include these pages in your navigation menu, instead of using the built-in WooCommerce shop or category pages.

If you prefer, you can add product tables directly to the main WooCommerce shop page or category archives. 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. Include custom field columns in your product tables, and these will appear in the product tables on the shop and category pages.

Display custom fields in a product quick view lightbox

WooCommerce Product Table Quick View Magnifying Glass

Maybe you’d rather list products in the usual way, and show extra custom fields in a quick view lightbox window.

You can do this by installing the WooCommerce Quick View Pro plugin, which will add quick view buttons or links to your store. Use it with WooCommerce Product Table to add product tables with custom field columns to the product short description. The short description will appear in the quick view lightbox for each product, complete with your WooCommerce custom fields.

Get Quick View

How to add custom fields to WooCommerce product page

WooCommerce custom fields taxonomies single product page
So far, I’ve shown you several ways of displaying custom fields on WordPress pages, the shop or product category pages. It’s also possible to show WooCommerce custom fields on the single product page (also known as the product detail page).

How to list WooCommerce products with a specific custom field value

Finally, I’ll show you one more option for showing WooCommerce custom fields in the Product Table plugin.

As well as displaying custom fields in the table layout, you can create tables containing products with a specific custom field value. For example, if you wanted to display products with a custom field value of ‘2018’ (saved in a custom field called ‘Year’) then you could do it with his shortcode:

For example, perhaps you have have a custom field called ‘condition’ and want to display products with a custom field value of ‘new’. You can do this using the following shortcode:

[product_table columns="name,cf:condition,price,add-to-cart" cf="condition:new"]

Method 2: Show a custom field above the add to cart button

So far, you’ve learned how to create a product table with each custom field displayed as a separate column.

If you simply want to show a custom field on the single product page, then there is a simpler option. You can do this using a simple but effective plugin called WooCommerce Lead Time. While most people use this plugin to display product waiting times, you can also use it as a general custom field plugin. The ‘lead time’ field is actually a WooCommerce custom field, and appears above the add to cart button. Therefore, you can use it to show any text-based information instead of lead times.

To set it up, install the plugin and add the custom field information to the ‘lead time’ field in the ‘Inventory’ tab on the ‘Edit Product’ screen. This text will display above the add to cart button, under the short description on the single product page.

As an added bonus, you can choose whether to add information to this custom field individually for specific products; or globally so that it displays on all product pages.

WooCommerce Lead Time
The only plugin to show waiting and processing times on the product page.

Method 3: Can you display WooCommerce custom fields without a plugin?

It is possible to display custom fields without the use of a plugin, but it’s really only accessible to developers. That’s why the method described above is a better option for most store owners.

We’ll provide a rapid-fire look at how it works, but we’d recommend skipping this method if you’re not sure how to use the code snippets. We’ll pull some of our example code from Plugin Republic’s GitHub page, and you’ll be adding these snippets to your WordPress child theme’s functions.php file.

With a programmatic approach, you can add custom information directly to your product meta data, and also include your custom field(s) as part of the existing WooCommerce product data meta box.

You could use the code snippet below to register a custom field, display the input field in the General tab of the WooCommerce product data box, and save it as product meta data:

/**
* Displays the custom text field input field in the WooCommerce product data meta box
*/
function cfwc_create_custom_field() {
$args = array(
'id' => 'custom_text_field_title',
'label' => __( 'Custom Text Field Title', 'cfwc' ),
'class' => 'cfwc-custom-field',
'desc_tip' => true,
'description' => __( 'Enter the title of your custom text field.', 'ctwc' ),
);
woocommerce_wp_text_input( $args );
}
add_action( 'woocommerce_product_options_general_product_data', 'cfwc_create_custom_field' );
/**
* Saves the custom field data to product meta data
*/
function cfwc_save_custom_field( $post_id ) {
$product = wc_get_product( $post_id );
$title = isset( $_POST['custom_text_field_title'] ) ? $_POST['custom_text_field_title'] : '';
$product->update_meta_data( 'custom_text_field_title', sanitize_text_field( $title ) );
$product->save();
}
add_action( 'woocommerce_process_product_meta', 'cfwc_save_custom_field' );

Then, you could use WooCommerce’s many hooks to display that field data on the front-end of your eCommerce store at the spot where you want it to appear.

For example, this snippet displays the custom field data after the add to cart button on your single product page:

/**
* Displays custom field data after the add to cart button
*/
function cfwc_display_custom_field() {
global $post;
// Check for the custom field value
$product = wc_get_product( $post->ID );
$title = $product->get_meta( 'custom_text_field_title' );
if( $title ) {
echo get_post_meta($post->ID, 'custom_text_field_title', true);
}
}
add_action( 'woocommerce_after_add_to_cart_button', 'cfwc_display_custom_field' );

There are also other hooks that let you display information on the WooCommerce checkout page or the cart page.

Unfortunately, you might need to add your own custom CSS to style the output of your custom fields.

The other type of WooCommerce custom fields – using add-ons to provide extra options for your customers

So far, we’ve talked about how to use custom fields to create and display extra information about your products. Next, we’ll talk about the other type of WooCommerce custom fields – selling additional options to your customers.

This type of custom field doesn’t just show extra information about the product. It actually provides extra options which the customer can select before adding the product to their cart. It’s a fantastic alternative to product variations because you can add a wide range of field types, instead of just dropdowns.

Introducing the Product Add-Ons plugin

WooCommerce Product Add-Ons is the official extension for adding product custom fields which allow shoppers to add extra options to their cart.

You can add a wide range of options which appear as custom fields for the customer to select. Shoppers can complete these extra fields and add them to their cart from the following locations:

  • The individual product page.
  • From your main product list, if you’re using WooCommerce Product Table.
  • From a quick view lightbox, if you’re using WooCommerce Quick View Pro. (Customers can access the lightbox from the main shop page or product category pages, so it’s a quick way to select add-on custom fields without having to visit a separate page for each product.)
Displaying WooCommerce add-ons in the WooCommerce Product Table
Example of WooCommerce Product Table used with Product Add-Ons
WooCommerce Quick View Plugin Product Add-Ons
Example of Product Add-Ons used to display the custom fields in a WooCommerce Quick View Pro lightbox

The easy way to show WooCommerce fields on your website

And that’s it! I’ve shown you how to add custom fields to WooCommerce products and store them in the WordPress back end without needing any special technical knowledge (as well as a quick look at how to do it programatically).

You’ve also learned how to show the WooCommerce custom fields in various locations on the the front end of your website – all using our bestselling WooCommerce Product Table plugin.

Follow the steps in this tutorial and put it into practice on your own website. It’s a fantastic non-technical way to store and display extra product data in WooCommerce.

WooCommerce Product Table
Start showing extra product data on your WooCommerce store today!

Katie Keith

An active member of the global WordPress community, Barn2 Co-Founder Katie loves collaborating with other plugin companies. Her articles have been published on high profile sites including WPTavern, Torque and IndieHackers. She oversees all plugin support and deals with 'Tier 2' support requests about how to use Barn2's plugins in advanced ways.

15 Comments

  1. Karin
    November 20, 2019 Reply

    Do you know if this type of customization is achievable with woocommerce, and if so how? It’s basically a single product that offers multiple stone choices, and the images changing accordingly. This is the best example I’ve found!

    https://ericaweiner.com/products/acrostic-ring-size-select

    TIA!

    • EJ
      November 21, 2019 Reply

      Hi, Karin. Thanks for the link/reference. I see each "step" affects the product price and so I suggest you add/include those "steps" as product add-ons via the official woocommerce.com extension WooCommerce Product Add-Ons (see our tutorial and front-end demo), which WooCommerce Product Table is officially integrated with and full compatibility is guaranteed. Thanks!

  2. John Meddaugh
    October 10, 2019 Reply

    We are turning this old site into a shopping cart and want to use WooCommerce and WooCommerce Product Table to show tables in the site like the old site's product tables. We will need 10+ custom fields for "Length of Cut", Shank Diameter" etc. - (many different dimensions/sizes per product). This involves a large CVS file. We can't figure out how to set up the CVS file to import all the Custom Fields dimensions. Should we set up the custom fields first in WooCommerce and then somehow the information will be added to each product at the import? We assumed Custom Fields was the way to do it, but is there a better way for this problem? Thank you.

    • EJ
      October 14, 2019 Reply

      Hi, John. Thanks for your comment and interest in WooCommerce Product Table, as well as also enquired via our Support Center.

      As mentioned in our email reply, you can import products to WooCommerce and then display them in a product table using our plugin. To do this, you can either use the built-in WordPress importer (under Tools > Import), or an import plugin such as WooCommerce Product CSV Import Suite. The documentation for the import plugin will normally include a sample CSV file that includes different field types, or you could ask their support team for advice on the exact format.

      We also recommend that you consider whether you really want to import the dimensions as custom fields, or to the dimensions field that is part of WooCommerce itself. You can display either as a column in WooCommerce Product Table (please see: Product table columns).

      I hope this makes sense and helps. Should you have any other questions, please let us know.

  3. Gerard
    September 10, 2019 Reply

    Hi,

    Great tutorial! Is it also possible to import data from a csv into the custom fields? When i try to import a csv with additional data with the Woocommerce importer, i can not select the custom fields i created with ACF.

    • EJ
      September 12, 2019 Reply

      Hi, Gerard. Thanks for your comment. The issue you're experiencing is because WooCommerce is understandably not aware of the custom fields, which you created using ACF. I believe you would need to import these differently and for the best way to do so, I suggest asking ACF themselves at https://support.advancedcustomfields.com/ .

  4. Eva Collados
    July 26, 2019 Reply

    Hi Katie! I've created a repeater field on ACF. Each row has a field for the client name and then a unique client code for the product. My client wants customers to be able to search for a product with their own code on WooCommerce table. Is this possible?
    Each product can also have more than one multipart product assembler brand, something that I also built with ACF. How can I on a specific product category filter the ones that are assembled by just one brand without showing by default the several product brands in a column table?
    Thanks in advance

    • EJ
      September 4, 2019 Reply

      Hi, Eva. I'm sorry for the delayed reply.

      The search box will look for exact match results for the unique client code in the content of all the columns in the product table, so yes you can do that. However, please note that you can create a column using the name of the parent ACF repeater field. This column will list the content of all the repeater fields for that product, separated by commas. It is not possible to display repeater sub-fields as separate columns in the table. (See: Custom field columns > ACF repeater fields. Hence, I imagine you wouldn't want all the client names and their codes exposed in a column like that, which could also be a large amount of text for each product in such a column.

      Instead, I suggest storing the client names and unique client codes in the product long description field and not display/include it in the table columns. When Lazy Load is enabled, the search box looks within the product title and the full contents of the long description for the product (regardless of whether these are present as columns in the table). This way, you can use the the long description as a searchable hidden column.

      You can also add/store the different brands in the "hidden" product long description this way. A search for any of the brands included in the long description will display the product in the resulting table results.

Please share your thoughts...

Your email address will not be published.