-
-
Save ChromeOrange/4dc8a8efadf6b67cbc29 to your computer and use it in GitHub Desktop.
get_pdf_order_totals
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
/** | |
* [get_pdf_order_totals description] | |
* New for Version 1.3.0, replaces several functions with one looped function | |
* @param [type] $order_id [description] | |
* @return [type] [description] | |
*/ | |
function get_pdf_order_totals( $order_id ) { | |
global $woocommerce; | |
if (!$order_id) return; | |
$order = new WC_Order( $order_id ); | |
$order_item_totals = $order->get_order_item_totals(); | |
unset( $order_item_totals['payment_method'] ); | |
$output = ''; | |
foreach ( $order_item_totals as $order_item_total ) { | |
$output .= '<tr>' . | |
'<td align="right">' . | |
'<strong>' . $order_item_total['label'] . '</strong></td>' . | |
'<td align="right"><strong>' . $order_item_total['value'] . '</strong></td>' . | |
'</tr>' ; | |
} | |
$output = apply_filters( 'pdf_template_order_totals' , $output, $order_id ); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment