Skip to content

Instantly share code, notes, and snippets.

@xadapter
Created October 4, 2017 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xadapter/74dcd9219da97ace4cd104ad1aa724e9 to your computer and use it in GitHub Desktop.
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
//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