WooCommerce: Add Custom Field to “Quick Edit”

WooCommerce product custom fields are possibly the most used customization from what I’ve seen over the years on clients’ websites.

Adding custom fields to the product backend is pretty straight forward (including the input fields to be used for editing their values), however there are two additional areas where you need to do more work in order to allow for custom field editing: the “Quick Edit” and the “Bulk Edit” sections (WordPress Dashboard > Products).

We already saw how to allow a new custom field to appear in the Bulk Edit section, so this time we’ll talk about the Quick Edit window. So, how do we add a custom field in there (WordPress Dashboard > Products > Hover on a given product > Quick Edit)?

Well, here’s a fully working snippet for you. Enjoy!

Here’s our custom field now showing in the Quick Edit window on the WooCommerce Products admin page

PHP Snippet: Add Custom Field to Quick Edit @ WooCommerce Products Admin

Please note that inside the snippet you need to replace “_custom_field” with the actual key of your custom field. Given you’ve probably added the custom field with a plugin, you should find its key inside the field settings. If you added it via code, then you’ve defined this key yourself.

 * @snippet       Add Custom Field @ WooCommerce Quick Edit Product
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 7
 * @community     https://businessbloomer.com/club/
add_action( 'woocommerce_product_quick_edit_start', 'bbloomer_show_custom_field_quick_edit' );

function bbloomer_show_custom_field_quick_edit() {
		<span class="title">Custom field</span>
		<span class="input-text-wrap">
			<input type="text" name="_custom_field" class="text" value="">
	<br class="clear" />

add_action( 'manage_product_posts_custom_column', 'bbloomer_show_custom_field_quick_edit_data', 9999, 2 );

function bbloomer_show_custom_field_quick_edit_data( $column, $post_id ){
    if ( 'name' !== $column ) return;
    echo '<div>Custom field: <span id="cf_' . $post_id . '">' . esc_html( get_post_meta( $post_id, '_custom_field', true ) ) . '</span></div>';
	 wc_enqueue_js( "
		$('#the-list').on('click', '.editinline', function() {
			var post_id = $(this).closest('tr').attr('id');
			post_id = post_id.replace('post-', '');
			var custom_field = $('#cf_' + post_id).text();
			$('input[name=\'_custom_field\']', '.inline-edit-row').val(custom_field);
	 " );

add_action( 'woocommerce_product_quick_edit_save', 'bbloomer_save_custom_field_quick_edit' );

function bbloomer_save_custom_field_quick_edit( $product ) {
    $post_id = $product->get_id();
    if ( isset( $_REQUEST['_custom_field'] ) ) {
        $custom_field = $_REQUEST['_custom_field'];
        update_post_meta( $post_id, '_custom_field', wc_clean( $custom_field ) );

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Add Second Description @ Product Category Pages
    In terms of SEO, if you’re trying to rank your product category pages, you really need to make the most of the default WooCommerce product category “description” and “thumbnail”. Most themes, if compatible with WooCommerce, will show this content right below the product category name and above products. Nothing new so far. But what if […]
  • WooCommerce: Add Custom Field to Product Variations
    Adding and displaying custom fields on WooCommerce products is quite simple. For example, you can add a “RRP/MSRP” field to a product, or maybe use ACF and display its value on the single product page. Easy, yes. Unfortunately, the above only applies to “simple” products without variations (or the parent product if it’s a variable […]
  • WooCommerce: Add Custom Product Fields (e.g. RRP) Without a Plugin
    The manufacturer’s suggested retail price (MSRP), or the recommended retail price (RRP), is the price at which the manufacturer recommends that the retailer sells the product at. You might have seen this in an ad, on a magazine, on a price tag: “RRP: $50. Our price: $39!”. WooCommerce entrepreneurs can take advantage of this “marketing […]
  • WooCommerce: Show Product Custom Field in the Category Pages
    A client asked me to show a given custom field in the loop (i.e. Shop page, Category pages, Tag pages = anywhere woocommerce products are returned). Interestingly enough, she didn’t want to show the product short description (see “show product short description on the homepage only” snippet) but a custom field, so here’s how you […]
  • WooCommerce: Add Column to Orders Table @ WP Dashboard
    The WooCommerce Orders Table, which can be found under WP Dashboard > WooCommerce > Orders, provides us with 7 default columns: Order – Date – Status – Billing – Ship to – Total – Actions. This is used by shop managers to have an overview of all orders, before eventually clicking on a specific one. […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

4 thoughts on “WooCommerce: Add Custom Field to “Quick Edit”

  1. add_action( ‘woocommerce_product_quick_edit_start’, ‘bbloomer_show_custom_field_quick_edit’ );

    function bbloomer_show_custom_field_quick_edit() {
    global $post;

    Here, global $post returns the same post for all the products in the list. how can i get individual product id in the list?

    1. Hello SF, what do you need that for exactly?

  2. Great article helped me a lot.
    I had to make a small modification though. Because I have more than one custom fields that I want to appear in quick edit, I had to change the id of each of my custom fields from ‘#cf_’ + post_id to ‘#cf_[something]’ + post_id and had to have that different for each individual custom field. Hope that helps someone.

    Also is there a way to have radio button-based custom fields appear in the quick edit? How do you set up that?

    1. Thank you for your feedback! In regard to the last question, I have no idea – but I don’t see why that wouldn’t be possible

Questions? Feedback? Customization? Leave your comment now!

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *