Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created April 9, 2024 06:54
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/5e01db453da70e6a72d846b1bd359f39 to your computer and use it in GitHub Desktop.
Save webtoffee-git/5e01db453da70e6a72d846b1bd359f39 to your computer and use it in GitHub Desktop.
Code to remove the fee name from the invoice pdf - By WebToffee
<?php //Do not copy this line of code
add_filter('wf_pklist_alter_find_replace', 'wt_pklist_alter_total_fee', 10, 6);
function wt_pklist_alter_total_fee($find_replace, $template_type, $order, $box_packing, $order_package, $html) {
if ('invoice' === $template_type && !empty($order)) {
if (is_object($order)) {
$order_id = method_exists($order, 'get_id') ? $order->get_id() : $order->id;
$user_currency = get_post_meta($order_id, '_order_currency', true);
$fee_details = $order->get_items('fee');
if (!empty($fee_details)) {
$total_fee = 0;
foreach ($fee_details as $fee_detail) {
$total_fee += $fee_detail->get_total();
}
$find_replace['[wfte_product_table_fee]'] = wc_price($total_fee, array('currency' => $user_currency));
}
}
}
return $find_replace;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment