Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created April 8, 2022 07:57
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 webtoffee-git/09a31e263e91f9a14545a2ec51780e3a to your computer and use it in GitHub Desktop.
Save webtoffee-git/09a31e263e91f9a14545a2ec51780e3a to your computer and use it in GitHub Desktop.
To hide commission meta in woocommerce PDF invoice
<?php// do not copy this line of code
add_filter('wf_pklist_modify_meta_data', 'webtoffee_modify_meta_data', 10, 2);
function webtoffee_modify_meta_data($meta) {
// Change the array keys according to the needs
$keys = array(
'wcb2bsa_item_commission'
);
foreach ($meta as $id => $value) {
if (in_array($id, $keys) && $id !== 0) {
if (isset($meta[$id])) {
unset($meta[$id]);
}
} else {
$meta[$id] = $value . '<br />';
}
}
return $meta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment