Metadata

Simple Fields

Allows to create easily settings pages and meta fields for posts, taxonomy terms, comments and users. Gutenberg sidebars are supported. Super-fast and minimalist plugin.

View plugin →

How to Add Custom Fields to Products in WooCommerce

In this tutorial, I will show you two ways of adding custom fields to products programmatically in WooCommerce – in every example, we will do it completely from scratch and with the help of my Simple Fields plugin.

Another interesting feature I am about to show you in this guide is how to show or hide specific product custom fields depending on a product type. For example, we can show our custom product fields for “Downloadable” or “Variable” products only.

Just like that:

WooCommerce add custom fields to a product programmatically
As you can see, we have added a product field to the “Advanced” tab, then we created a conditional “Misha” custom tab and added some additional custom product fields there as well.

How to Use Select2 Multiselect in Meta Boxes

In this tutorial, I will show you two examples of how to use Select2 when creating custom fields in WordPress admin. Particularly, I will show you how to do it in meta boxes in the classic editor, but you can do the same for taxonomy settings or options pages.

In the first example, we will use Select2 to create a multiselect dropdown with tags. In the second one, it will become more interesting; we will do the same for posts, but also with an AJAX search (both examples will also be implemented in two ways – programmatically and with my Simple Fields plugin).

Add Fields into WooCommerce New Product Editor

Since I have a plugin that allows you to share products between different WooCommerce stores, I’ve been keeping an eye on the New Product Editor for quite a long time.

I know that people have different opinions about it, but this post is not about whether you like this new product editing experience or not, it is all about adding your custom product fields into it.

As a result of this tutorial, we will have a custom checkbox field in the “Organization” tab:

How to add custom fields into the new WooComerce product editor
As an example, I decided to show you the fields I will need to add to my Simple WP Crossposting plugin when the new WooCommerce product editor goes out of beta.

Let’s dive into this whole process step by step.

How to Update Post Meta with WordPress REST API

This tutorial is an addition to my another tutorial about creating posts using REST API in WordPress, because in that post I didn’t mention how to work with meta fields. So now we’re going to add (or update) meta fields of a specific post with the help of REST API requests.

By the way, the whole process is similar when you work for example with term meta, not only with post meta.

How to Add Custom Fields to Order Details Page

In this tutorial I am going to talk about customers order details page, that is located in My Account > Orders > View Order. In case you are looking for a solution how to add custom fields to edit order page in WordPress admin, there is a separate tutorial for that.

Add Fields to Edit Order Page

First things first, if you need to display custom fields in View Order page in My Account, you need another tutorial. In this tutorial we are going to do it in WordPress admin only.

Here is what we are going to create:

Add custom editable information to the Order Details