Admin panel should not hide _ meta.

Fixes #13510
This commit is contained in:
Mike Jolley 2017-03-09 11:45:22 +00:00
parent ee713f82cc
commit a185e57ccb
2 changed files with 21 additions and 32 deletions

View File

@ -1,20 +1,21 @@
<div class="view">
<?php if ( $meta_data = $item->get_formatted_meta_data() ) : ?>
<?php
$hidden_order_itemmeta = apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost',
) );
?><div class="view">
<?php if ( $meta_data = $item->get_formatted_meta_data( '' ) ) : ?>
<table cellspacing="0" class="display_meta">
<?php foreach ( $meta_data as $meta_id => $meta ) :
// Skip hidden core fields
if ( in_array( $meta->key, apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost',
) ) ) ) {
if ( in_array( $meta->key, $hidden_order_itemmeta ) ) {
continue;
}
?>
@ -29,21 +30,9 @@
<div class="edit" style="display: none;">
<table class="meta" cellspacing="0">
<tbody class="meta_items">
<?php if ( $meta_data = $item->get_formatted_meta_data() ) : ?>
<?php if ( $meta_data = $item->get_formatted_meta_data( '' ) ) : ?>
<?php foreach ( $meta_data as $meta_id => $meta ) :
// Skip hidden core fields
if ( in_array( $meta->key, apply_filters( 'woocommerce_hidden_order_itemmeta', array(
'_qty',
'_tax_class',
'_product_id',
'_variation_id',
'_line_subtotal',
'_line_subtotal_tax',
'_line_total',
'_line_tax',
'method_id',
'cost',
) ) ) ) {
if ( in_array( $meta->key, $hidden_order_itemmeta ) ) {
continue;
}
?>

View File

@ -181,10 +181,10 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
* @return array
*/
public function get_formatted_meta_data( $hideprefix = '_' ) {
$formatted_meta = array();
$meta_data = $this->get_meta_data();
$formatted_meta = array();
$meta_data = $this->get_meta_data();
$hideprefix_length = ! empty( $hideprefix ) ? strlen( $hideprefix ) : 0;
$product = is_callable( array( $this, 'get_product' ) ) ? $this->get_product() : false;
$product = is_callable( array( $this, 'get_product' ) ) ? $this->get_product() : false;
foreach ( $meta_data as $meta ) {
if ( "" === $meta->value || is_serialized( $meta->value ) || ( $hideprefix_length && substr( $meta->key, 0, $hideprefix_length ) === $hideprefix ) ) {