Merge pull request #1418 from kloon/master
Hide meta through prefix with display function
This commit is contained in:
commit
2605bf3da6
|
@ -1452,9 +1452,10 @@ class WC_Order_Item_Meta {
|
||||||
* @access public
|
* @access public
|
||||||
* @param bool $flat (default: false)
|
* @param bool $flat (default: false)
|
||||||
* @param bool $return (default: false)
|
* @param bool $return (default: false)
|
||||||
|
* @param string $hideprefix (default: blank)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function display( $flat = false, $return = false ) {
|
function display( $flat = false, $return = false, $hideprefix = '' ) {
|
||||||
global $woocommerce;
|
global $woocommerce;
|
||||||
|
|
||||||
if ( $this->meta && is_array( $this->meta ) ) :
|
if ( $this->meta && is_array( $this->meta ) ) :
|
||||||
|
@ -1464,9 +1465,15 @@ class WC_Order_Item_Meta {
|
||||||
$meta_list = array();
|
$meta_list = array();
|
||||||
|
|
||||||
foreach ( $this->meta as $meta ) :
|
foreach ( $this->meta as $meta ) :
|
||||||
|
if ( !empty( $hideprefix) ) {
|
||||||
$name = $meta['meta_name'];
|
if ( substr( $meta['meta_name'], 0, 1 ) <> $hideprefix ) {
|
||||||
$value = $meta['meta_value'];
|
$name = $meta['meta_name'];
|
||||||
|
$value = $meta['meta_value'];
|
||||||
|
} else continue;
|
||||||
|
} else {
|
||||||
|
$name = $meta['meta_name'];
|
||||||
|
$value = $meta['meta_value'];
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! $value ) continue;
|
if ( ! $value ) continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue