Admin Dashboard, Product Page

WooCommerce Custom Text Area Field For Editing Products

WooCommerce custom textarea-field-in-the-product-editor


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

You may wish to replace the default My Account Navigation Link icons with icons which are more appropriate and inline with your business branding. In our example, we have replaced the dashboard icon ( ) with a lightbulb icon ( ). To replace the icons, follow the steps in this quick guide.

 * Snippet Name:     WooCommerce Custom Product Text Area Metabox
 * Snippet Author:

// Create the custom product metabox
add_action ('woocommerce_product_options_advanced', 'ecommercehints_custom_product_textarea_metabox');
function ecommercehints_custom_product_textarea_metabox() {
   echo '<div class="options_group">';
   woocommerce_wp_textarea_input (array ( // A textarea type field
      'id'                => 'custom_product_textarea_metabox',
      'value'             => get_post_meta (get_the_ID(), 'custom_product_textarea_metabox', true),
      'label'             => 'This is the label',
      'description'       => 'This is the description',
      'desc_tip'          => true // If true, place description in question mark tooltip.
   echo '</div>';

// Save data entered in the product metabox
add_action ('woocommerce_process_product_meta', 'ecommercehints_save_field_on_update', 10, 2);
function ecommercehints_save_field_on_update ($id, $post) {
      update_post_meta ($id, 'custom_product_textarea_metabox', $_POST['custom_product_textarea_metabox']);

How Do I Get The Custom Text Area Field Data?

global $product;
$custom_product_textarea_metabox = $product->get_meta ('custom_product_textarea_metabox');
echo $custom_product_textarea_metabox;

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.