Created
April 9, 2024 06:54
-
-
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
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
<?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