Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Last active April 18, 2024 06:41
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/4a5d0c4dcde659496638177a1ea1e842 to your computer and use it in GitHub Desktop.
Save webtoffee-git/4a5d0c4dcde659496638177a1ea1e842 to your computer and use it in GitHub Desktop.
Code to to remove incl. tax text from subtotal and total - By WebToffee
<?php //Do not copy this line of code
add_filter('wf_pklist_alter_find_replace','wt_pklist_show_order_total' ,10,6);
function wt_pklist_show_order_total($find_replace, $template_type, $order, $box_packing, $order_package, $html)
{
if( 'invoice' === $template_type )
{
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$user_currency = get_post_meta($order_id, '_order_currency', true);
$total_price = (WC()->version< '2.7.0' ? $order->order_total : get_post_meta($order_id,'_order_total',true));
if( !empty( $total_price ) )
{
$find_replace['[wfte_product_table_payment_total]']=wc_price($total_price,array('currency'=>$user_currency));
}
}
return $find_replace;
}
add_filter('wf_pklist_alter_tax_info_text','wf_pklist_remove_tax_text',10,6);
function wf_pklist_remove_tax_text($tax_data, $tax_type, $tax_items_total, $user_currency, $template_type, $order)
{
if( 'invoice' === $template_type )
{
return $tax_data = '';
}
return $tax_data;
}
add_filter('wf_pklist_alter_subtotal_formated', 'wt_pklist_alter_formated_sub', 10, 4);
function wt_pklist_alter_formated_sub($sub_total_formated, $template_type, $sub_total, $order)
{
$sub_total_formated = wc_price($sub_total);
return $sub_total_formated;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment