Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created May 10, 2025 06:55
Show Gist options
  • Save webtoffee-git/625aa3db2a308a722a832757a7f16c29 to your computer and use it in GitHub Desktop.
Save webtoffee-git/625aa3db2a308a722a832757a7f16c29 to your computer and use it in GitHub Desktop.
To hide 'via Fee Total amount' in the Invoice document - By WebToffee ( WooCommerce PDF Invoices, Packing Slips, Delivery Notes, and Shipping Labels)
<?php //do not copy this line of code
add_filter('wf_pklist_alter_find_replace','wf_pklist_alter_fee_details',10,6);
function wf_pklist_alter_fee_details($find_replace, $template_type, $order, $box_packing, $order_package, $html)
{
if($template_type=='invoice')
{
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$user_currency=get_post_meta($order_id, '_order_currency', true);
$fee_details=$order->get_items('fee');
if(!empty($fee_details))
{
$fee_arr = array();
foreach($fee_details as $fee_detail)
{
$fee_arr[] = wc_price($fee_detail['amount'],array('currency'=>$user_currency)).' via '.$fee_detail['name'];
}
$find_replace['[wfte_product_table_fee]']=implode('<br />', $fee_arr);
}
else
{
$find_replace['[wfte_product_table_fee]']='';
}
}
return $find_replace;
}
@trixxmanaty
Copy link

Thank you. This worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment