Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

Totals::render_order_details_table_totals()protectedWC 1.0

Render order details table totals.

Метод класса: Totals{}

Хуков нет.

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->render_order_details_table_totals( $order );
$order(\WC_Order) (обязательный)
Order object.

Код Totals::render_order_details_table_totals() WC 9.5.1

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;
}