Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
Totals::render_order_details_table_totals
Render order details table totals.
Method of the class: Totals{}
No Hooks.
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->render_order_details_table_totals( $order );
- $order(WC_Order) (required)
- Order object.
Totals::render_order_details_table_totals() Totals::render order details table totals code WC 10.4.3
protected function render_order_details_table_totals( $order ) {
add_filter( 'woocommerce_order_shipping_to_display_shipped_via', '__return_empty_string' );
$return = '';
$total_rows = array_diff_key(
$order->get_order_item_totals(),
array(
'cart_subtotal' => '',
'payment_method' => '',
)
);
foreach ( $total_rows as $total ) {
$return .= '
<tr>
<th class="wc-block-order-confirmation-totals__label" scope="row">' . esc_html( $total['label'] ) . '</th>
<td class="wc-block-order-confirmation-totals__total">' . wp_kses_post( $total['value'] ) . '</td>
</tr>
';
}
return $return;
}