Automattic\WooCommerce\Internal\Admin\Orders
ListTable::render_order_number_column()
Renders the order number, customer name and provides a preview link.
Метод класса: ListTable{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$ListTable = new ListTable(); $ListTable->render_order_number_column( $order ): void;
- $order(WC_Order) (обязательный)
- The order object for the current row.
Код ListTable::render_order_number_column() ListTable::render order number column WC 9.4.2
public function render_order_number_column( WC_Order $order ): void { $buyer = ''; if ( $order->get_billing_first_name() || $order->get_billing_last_name() ) { /* translators: 1: first name 2: last name */ $buyer = trim( sprintf( _x( '%1$s %2$s', 'full name', 'woocommerce' ), $order->get_billing_first_name(), $order->get_billing_last_name() ) ); } elseif ( $order->get_billing_company() ) { $buyer = trim( $order->get_billing_company() ); } elseif ( $order->get_customer_id() ) { $user = get_user_by( 'id', $order->get_customer_id() ); $buyer = ucwords( $user->display_name ); } /** * Filter buyer name in list table orders. * * @since 3.7.0 * * @param string $buyer Buyer name. * @param WC_Order $order Order data. */ $buyer = apply_filters( 'woocommerce_admin_order_buyer_name', $buyer, $order ); if ( $order->get_status() === 'trash' ) { echo '<strong>#' . esc_attr( $order->get_order_number() ) . ' ' . esc_html( $buyer ) . '</strong>'; } else { echo '<a href="#" class="order-preview" data-order-id="' . absint( $order->get_id() ) . '" title="' . esc_attr( __( 'Preview', 'woocommerce' ) ) . '">' . esc_html( __( 'Preview', 'woocommerce' ) ) . '</a>'; echo '<a href="' . esc_url( $this->get_order_edit_link( $order ) ) . '" class="order-view"><strong>#' . esc_attr( $order->get_order_number() ) . ' ' . esc_html( $buyer ) . '</strong></a>'; } // Used for showing date & status next to order number/buyer name on small screens. echo '<div class="order_date small-screen-only">'; $this->render_order_date_column( $order ); echo '</div>'; echo '<div class="order_status small-screen-only">'; $this->render_order_status_column( $order ); echo '</div>'; }