-
-
Save PechenkiUA/c8c0d236a81447daf82450aa01d2c390 to your computer and use it in GitHub Desktop.
Telsender free item
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
function telsender_fee_total($list, $order_id){ | |
// (optional if not defined) An instance of the WC_Order object | |
$the_order = wc_get_order( $order_id ); | |
$fee_total = 0; | |
// Iterating through order fee items ONLY | |
foreach( $the_order->get_items('fee') as $item_id => $item_fee ){ | |
// The fee name | |
$fee_name = $item_fee->get_name(); | |
// The fee total amount | |
$fee_total += $item_fee->get_total(); | |
// The fee total tax amount | |
$fee_total_tax = $item_fee->get_total_tax(); | |
} | |
$list['{fee_total}'] = $fee_total ; | |
return $list; | |
} | |
add_filter( 'tscf_filter_codetemplate','telsender_fee_total', 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment