Created
October 4, 2017 06:14
-
-
Save xadapter/74dcd9219da97ace4cd104ad1aa724e9 to your computer and use it in GitHub Desktop.
Alter or hide order meta details in Invoice, Packing Slip & Delivery notes with Print Invoice, Packing Slip, Delivery Note & Label for WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//code snippet to replace meta key with value | |
add_filter('wf_pklist_modify_meta_data', 'wf_pklist_change_meta_data_label', 1); | |
function wf_pklist_change_meta_data_label($meta_data) | |
{ | |
//replace the array key value with your custom key value. | |
$label_array = array( | |
'_wcj_product_input_fields_local_1' => 'Global Desc', | |
'_wcj_product_input_fields_global_1' => 'Local Desc' | |
); | |
$new_meta_data = array(); | |
foreach( $meta_data as $id => $value) { | |
if(array_key_exists($id, $label_array)){ | |
$new_meta_data[$label_array[$id]] = $value; | |
} else { | |
$new_meta_data[$id] = $value; | |
} | |
} | |
return $new_meta_data; | |
} | |
//code snippet to hide all meta keys | |
add_filter('wf_pklist_modify_meta_data', 'wf_pklist_change_meta_data_label', 1); | |
function wf_pklist_change_meta_data_label($meta_data) | |
{ | |
//replace the array key value with your custom key value. | |
$label_array = array(); | |
return $label_array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment