Home » WooCommerce: View Product/Order Hidden Custom Fields (“Protected Meta”)

WooCommerce: View Product/Order Hidden Custom Fields (“Protected Meta”)

by Tutor Aspire

I was working on a WooCommerce project recently and I didn’t want to waste time searching through all the hidden product post meta.

Post meta are basically product custom fields that are added via the update_post_meta() WordPress function by WooCommerce itself, a custom plugin, a snippet, a theme. For example, “total_sales” is a default WooCommerce product custom field that updates every time the product is purchased. You can “get” total sales with the get_post_meta() WordPress function.

In the same way, there are dozens of default and third party product custom fields that are stored inside the WooCommerce product meta. If the product custom field “meta key” starts with an underscore (“_”), however, this won’t be visible in the “Custom Fields” section of the edit product page screen. Which is a bummer.

So, today, I’ll show you a quick trick so you can always know what the values for product meta keys are without having to mess with print_r() or error_log() in your PHP functions. In the image below, you see the final outcome.

Please note this also shows order hidden meta.


WordPress will not show custom fields which have meta_key starting with an “_” (underscore) in the custom fields list on the post edit screen. Here on the single product page edit screen, after installing my snippet, you can now see how “_backorders” is now visible for example. That was previously hidden!

PHP Snippet: Show Post/Product/Order/Page Hidden Custom Fields @ Edit Post Page

 * @snippet       Show Hidden Custom Fields @ WooCommerce Product / Order Edit
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 5.1
 * @donate $9     https://tutoraspire.com

add_filter( 'is_protected_meta', '__return_false' ); 

You may also like