Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
Totals::render_order_details_table_item()
Render an item in the order details table.
Метод класса: Totals{}
Хуки из метода
Возвращает
Строку
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->render_order_details_table_item( $order, $item_id, $item, $product );
- $order(\WC_Order) (обязательный)
- Order object.
- $item_id(int) (обязательный)
- Item ID.
- $item(\WC_Order_Item) (обязательный)
- Item object.
- $product(\WC_Product|false) (обязательный)
- Product object if it exists.
Код Totals::render_order_details_table_item() Totals::render order details table item WC 9.6.0
protected function render_order_details_table_item( $order, $item_id, $item, $product ) { $is_visible = $product && $product->is_visible(); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment $row_class = apply_filters( 'woocommerce_order_item_class', 'woocommerce-table__line-item order_item', $item, $order ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment $product_permalink = apply_filters( 'woocommerce_order_item_permalink', $is_visible ? $product->get_permalink( $item ) : '', $item, $order ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment $item_name = apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $item->get_name() ) : $item->get_name(), $item, $is_visible ); $qty = $item->get_quantity(); $refunded_qty = $order->get_qty_refunded_for_item( $item_id ); $qty_display = $refunded_qty ? '<del>' . esc_html( $qty ) . '</del> <ins>' . esc_html( $qty - ( $refunded_qty * -1 ) ) . '</ins>' : esc_html( $qty ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment $item_qty = apply_filters( 'woocommerce_order_item_quantity_html', '<strong class="product-quantity">' . sprintf( '× %s', $qty_display ) . '</strong>', $item ); return ' <tr class="' . esc_attr( $row_class ) . '"> <td class="wc-block-order-confirmation-totals__product"> ' . wp_kses_post( $item_name ) . ' ' . wp_kses_post( $item_qty ) . ' ' . $this->get_hook_content( 'woocommerce_order_item_meta_start', [ $item_id, $item, $order, false ] ) . ' ' . wc_display_item_meta( $item, [ 'echo' => false ] ) . ' ' . $this->get_hook_content( 'woocommerce_order_item_meta_end', [ $item_id, $item, $order, false ] ) . ' ' . $this->render_order_details_table_item_purchase_note( $order, $product ) . ' </td> <td class="wc-block-order-confirmation-totals__total"> ' . wp_kses_post( $order->get_formatted_line_subtotal( $item ) ) . ' </td> </tr> '; }